/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 604.0 KiB
#2 Accepted 2ms 340.0 KiB

Code

#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int t;
    cin>>t;
    while (t--) {
        int n;
        cin >> n;
        int arr[n];
        for (int i = 0; i < n; i++) {
            cin >> arr[i];
        }

        sort(arr, arr+n);

        bool cheak= true;
        for (int i = 0; i < n; i++) {
            if (arr[i] != i + 1) {
                cheak = false;
                break;
            }
        }
        
        if (cheak) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    
    return 0;
}

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 15:19:43
Judged At
2024-11-11 03:34:42
Judged By
Score
100
Total Time
2ms
Peak Memory
604.0 KiB