/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 3ms 344.0 KiB

Code

#include<bits/stdc++.h>
using namespace  std;
using ll = long long;
 
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int t; cin >> t;
    while(t--) {
        int n; cin >> n;
        vector<int> v(n+1, 0);
        for(int i = 0; i < n; i++) {
        int p; cin >> p;
        v[p]++;
        }

        bool ok = true;

        for(int i = 1; i <= n; i++) {
            if(v[i] == 0) {
                ok = false;
                break;
            }
        }

        if(ok) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1055 Array Permutation
Contest
Brain Booster #3
Language
C++17 (G++ 13.2.0)
Submit At
2024-05-06 15:05:03
Judged At
2024-11-11 03:35:17
Judged By
Score
100
Total Time
3ms
Peak Memory
540.0 KiB