Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int t;
- cin >> t;
- while(t--){
- int n;
- cin >> n;
- int A[n];
- for (int i = 0; i < n; i++)
- cin >> A[i];
- int f = 1;
- sort(A, A + n);
- for (int i = 0; i < n; i++) {
- if (A[i] > i + 1)
- f = 0;
- }
- if (f)
- cout << "YES"<<endl;
- else
- cout << "NO"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment