Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> pii;
- #define F first
- #define S second
- const int MAXN = 1e5 + 10;
- int n, a[MAXN];
- int main(){
- ios::sync_with_stdio(false);
- cin.tie(0);
- int te; cin >> te;
- while (te--){
- cin >> n;
- for (int i = 0; i < n; i++) cin >> a[i];
- sort(a, a + n);
- int cur = 0;
- for (int i = 0; i < n; i++)
- if (a[i] <= cur) cur++;
- cout << cur << "\n";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment