100322024-03-24 23:09:08RRoliMexxcpp17Partially correct 0/1003ms4728 KiB
#include <bits/stdc++.h>
using namespace std;

int n, a[500001], b[500001];
set<int> marvan;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ifstream f("be.in");

    f >> n;
    for(int i = 1; i <= n; i++) {
        f >> a[i];
        b[i] = -1;
        marvan.insert(a[i]);
    }
    for(int i = 1; i < n; i++)
        if(a[i+1] > a[i])
            b[i+1] = a[i];

    int szam = 0;
    bool jo = true;
    for(int i = 1; i <= n; i++) {
        while(marvan.count(szam) == 1) szam++;
        if(b[i] == -1) {
            b[i] = szam;
            szam++;
        } else if(szam < b[i]-1)
            jo = false;
    }

    if(!jo || szam > 2*n+1) cout << "NEM";
    else {
        cout << "IGEN\n";
        for(int i = 1; i <= n; i++) cout << b[i] << ' ';
    }

    return 0;
}


SubtaskSumTestVerdictTimeMemory
subtask10/0
1Partially correct3ms1964 KiB
2Partially correct3ms2180 KiB
subtask20/8
3Partially correct3ms2392 KiB
4Partially correct3ms2476 KiB
5Partially correct3ms2668 KiB
6Partially correct3ms2608 KiB
7Wrong answer3ms2804 KiB
8Partially correct3ms3004 KiB
9Partially correct3ms3228 KiB
10Partially correct3ms3196 KiB
11Wrong answer3ms3324 KiB
subtask30/16
12Partially correct3ms3524 KiB
13Partially correct3ms3500 KiB
14Partially correct3ms3600 KiB
15Wrong answer3ms3524 KiB
16Wrong answer2ms3608 KiB
subtask40/32
17Partially correct3ms3700 KiB
18Partially correct3ms3700 KiB
19Partially correct3ms3736 KiB
20Partially correct3ms3828 KiB
21Partially correct3ms3820 KiB
22Partially correct2ms3828 KiB
23Wrong answer2ms3968 KiB
24Wrong answer2ms3936 KiB
subtask50/44
25Partially correct3ms3928 KiB
26Partially correct3ms3908 KiB
27Partially correct3ms3904 KiB
28Partially correct3ms4188 KiB
29Partially correct3ms4128 KiB
30Partially correct3ms4092 KiB
31Partially correct3ms4316 KiB
32Partially correct3ms4192 KiB
33Partially correct3ms4320 KiB
34Partially correct3ms4412 KiB
35Partially correct3ms4652 KiB
36Wrong answer3ms4728 KiB
37Wrong answer3ms4600 KiB