/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 3ms 564.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

#define RASHED ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define int long long int

#define show(x) cout << #x << " = " << x << endl
#define inf (int)1e17
#define maxn 100010

#define F first
#define S second

bool solve(int tc) {
    int n;cin>>n;
    map<int,int> f;
    for(int i=1;i<=n;i++){
        int x;cin>>x;
        f[x]++;
    }
    for(int i=1;i<=n;i++){
        if(f[i] == 0 || f[i] > 1)return false;
    }
    return true;
}
signed main() {
    RASHED
    int TC = 1;
    cin>>TC;
    for(int i=1; i<=TC; i++)cout<<(solve(i)?"YES":"NO")<<endl;
    return 0;
}
/**
CASES:

*/

Information

Submit By
Type
Submission
Problem
P1055 Array Permutation
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 17:31:50
Judged At
2024-10-03 13:48:29
Judged By
Score
100
Total Time
3ms
Peak Memory
564.0 KiB