Guest User

CHEFPARTY Tester

a guest
Feb 17th, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6. typedef pair<int, int> pii;
  7.  
  8. #define F first
  9. #define S second
  10.  
  11. const int MAXN = 1e5 + 10;
  12.  
  13. int n, a[MAXN];
  14.  
  15. int main(){
  16.     ios::sync_with_stdio(false);
  17.     cin.tie(0);
  18.     int te; cin >> te;
  19.     while (te--){
  20.         cin >> n;
  21.         for (int i = 0; i < n; i++) cin >> a[i];
  22.         sort(a, a + n);
  23.         int cur = 0;
  24.         for (int i = 0; i < n; i++)
  25.             if (a[i] <= cur) cur++;
  26.         cout << cur << "\n";
  27.     }
  28.     return 0;
  29. }
Add Comment
Please, Sign In to add comment