106112024-04-06 14:51:49AblablablaMexxcpp17Wrong answer 0/100270ms17476 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> szamok(n);
    for(int i = 0; i < n; i++){
        cin >> szamok[i];
    }

    for(int i = 0; i < n; i++){
        if(szamok[i] > i + 1){
            cout << "NEM\n";
            return 0;
        }
    }

    cout << "IGEN\n";

    vector<bool> foglalt(2 * n + 1, 0);
    if(szamok[0] != 0) foglalt[0] = 1;
    for(int i = 1; i < n; i++){
        if(szamok[i - 1] != szamok[i]){
            foglalt[szamok[i - 1]] = 1;
        }
    }
    foglalt[szamok[n - 1]] = 1;

    vector<int> szabad;
    for(int i = 0; i <= 2 * n; i++){
        if(!foglalt[i]){
            szabad.push_back(i);
        }
    }

    int ind = 0;

    if(szamok[0] == 0){
        cout << szabad[ind] << " ";
        ind++;
    } else{
        cout << "0 ";
    }

    for(int i = 1; i < n; i++){
        if(szamok[i - 1] != szamok[i]){
            cout << szamok[i - 1] << " ";
        } else{
            cout << szabad[ind] << " ";
            ind++;
        }
    }

    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1996 KiB
2Accepted3ms2224 KiB
subtask20/8
3Accepted3ms2460 KiB
4Accepted3ms2476 KiB
5Accepted3ms2588 KiB
6Accepted3ms2716 KiB
7Accepted3ms2808 KiB
8Accepted3ms2932 KiB
9Accepted3ms3164 KiB
10Accepted3ms3244 KiB
11Wrong answer3ms3352 KiB
subtask30/16
12Accepted3ms3596 KiB
13Accepted3ms3724 KiB
14Accepted3ms3940 KiB
15Accepted3ms3948 KiB
16Wrong answer3ms3940 KiB
subtask40/32
17Accepted6ms4348 KiB
18Accepted6ms4440 KiB
19Accepted6ms4544 KiB
20Accepted6ms4568 KiB
21Accepted6ms4668 KiB
22Accepted6ms4644 KiB
23Accepted4ms4396 KiB
24Wrong answer6ms4652 KiB
subtask50/44
25Accepted264ms16728 KiB
26Accepted266ms16840 KiB
27Accepted266ms16728 KiB
28Accepted264ms17012 KiB
29Accepted270ms17220 KiB
30Accepted263ms17016 KiB
31Accepted266ms17016 KiB
32Accepted268ms17304 KiB
33Accepted266ms17216 KiB
34Accepted268ms17476 KiB
35Accepted268ms17404 KiB
36Accepted187ms8756 KiB
37Wrong answer266ms17340 KiB