/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 768.0 KiB

Code

#include<bits/stdc++.h>
#define ll    long long int
#define yes   "YES"
#define no    "NO"
#define nl    "\n"
using namespace std;

void solve()
{
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    sort(a.begin(),a.end());
    int ans=0;
    for(int i=0;i<n;i++){
        if(a[i]==i+1)
            ans++;
    }
    if(ans==n)
        cout<<yes<<nl;
    else
        cout<<no<<nl;
    //cout<<ans<<nl;

}

int main()
{
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}


Information

Submit By
Type
Submission
Problem
P1055 Array Permutation
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-10 15:20:53
Judged At
2024-05-10 15:20:53
Judged By
Score
100
Total Time
2ms
Peak Memory
768.0 KiB