Saleh127

CF 1406A

Sep 12th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10. ///@!]
  11.  
  12. test
  13. {
  14. ll a[105]={0},c,d,e=0,f=0,i,j=0,k=0,l=0,x[105]={0},y[105]={0};;
  15. cin>>c;
  16. for(i=1; i<=c; i++)
  17. {
  18. cin>>d;
  19. a[d]++;
  20. e=max(e,d);
  21. }
  22. for(i=0; i<=e; i++)
  23. {
  24. if(a[i]>1)
  25. {
  26. x[i]++;
  27. y[i]++;
  28. }
  29. else if(a[i]==1)
  30. {
  31. x[i]++;
  32. }
  33. }
  34. for(i=0; i<=100; i++)
  35. {
  36. if(x[i]==0)
  37. {
  38. f=i;
  39. break;
  40. }
  41. }
  42. for(i=0; i<=100; i++)
  43. {
  44. if(y[i]==0)
  45. {
  46. l=i;
  47. break;
  48. }
  49. }
  50. cout<<f+l<<endl;
  51. }
  52.  
  53. return 0;
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment