104892024-04-03 12:10:54csaron71Mexxcpp17Runtime error 92/100250ms17352 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> szamok;
    vector<int> valt;
    bool vege=false;
    for (int i=0; i<n; i++) {
        int x;
        cin >> x;
        szamok.push_back(x);
        if (szamok[i]>i+1) {
            vege=true;
        }
    }
    if (vege==true) {
        cout << "NEM\n";
        return 0;
    }
    for (int i=1; i<n; i++) {
        if (szamok[i]<szamok[i-1]) {
            cout << "NEM\n";
            return 0;
        }
        if (szamok[i]>szamok[i-1]) {
            valt.push_back(szamok[i]);
        }
    }

    int epp=0;
    vector<int> veg;
    int y=0;
    if (szamok[0]==0) {
        epp++;
        while (epp==valt[y]) {
            epp++;
            y++;
        }
        veg.push_back(epp);
    }
    else  {
        veg.push_back(epp);
        epp++;
    }
    for (int i=1; i<n; i++) {
        if (szamok[i]>szamok[i-1]) {
             veg.push_back(szamok[i-1]);
        }
        else {
            epp++;
            while (epp==valt[y]) {
                epp++;
                y++;
            }
            veg.push_back(epp);
        }
    }
    cout << "IGEN\n";
    for (int sz : veg) {
        cout << sz << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1816 KiB
2Accepted3ms2204 KiB
subtask20/8
3Runtime error3ms2240 KiB
4Accepted2ms2240 KiB
5Accepted3ms2432 KiB
6Accepted2ms2516 KiB
7Accepted2ms2512 KiB
8Runtime error3ms2492 KiB
9Accepted3ms2648 KiB
10Accepted3ms2896 KiB
11Accepted2ms2944 KiB
subtask316/16
12Accepted3ms3076 KiB
13Accepted2ms3156 KiB
14Accepted3ms3156 KiB
15Accepted3ms3292 KiB
16Accepted3ms3500 KiB
subtask432/32
17Accepted6ms3692 KiB
18Accepted4ms3704 KiB
19Accepted6ms3952 KiB
20Accepted6ms3968 KiB
21Accepted6ms4112 KiB
22Accepted6ms4008 KiB
23Accepted4ms3960 KiB
24Accepted4ms4012 KiB
subtask544/44
25Accepted244ms13672 KiB
26Accepted245ms13660 KiB
27Accepted245ms13660 KiB
28Accepted245ms13660 KiB
29Accepted246ms16064 KiB
30Accepted246ms16084 KiB
31Accepted247ms16156 KiB
32Accepted246ms16144 KiB
33Accepted250ms16400 KiB
34Accepted250ms16756 KiB
35Accepted250ms17352 KiB
36Accepted175ms8484 KiB
37Accepted177ms8492 KiB