104702024-04-03 07:48:50RRoliMexxcpp17Wrong answer 0/100108ms12980 KiB
#include <bits/stdc++.h>
using namespace std;

int n, a[500001], b[500001];
bool c[1000001];

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin>> n;
    for(int i = 1; i <= n; i++) {
        cin>> a[i];
        b[i] = -1;
        c[a[i]] = true;
    }
    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(c[szam]) szam++;
        if(b[i] == -1) {
            b[i] = szam;
            szam++;
        } else if(szam < b[i]-1)
            jo = false;
    }

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

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1904 KiB
2Accepted3ms2244 KiB
subtask20/8
3Accepted2ms2196 KiB
4Accepted3ms2436 KiB
5Accepted3ms2644 KiB
6Accepted3ms2984 KiB
7Wrong answer2ms2812 KiB
8Accepted3ms2816 KiB
9Accepted3ms2944 KiB
10Accepted3ms3276 KiB
11Wrong answer2ms3232 KiB
subtask30/16
12Accepted3ms3560 KiB
13Accepted2ms3448 KiB
14Accepted3ms3516 KiB
15Wrong answer3ms3784 KiB
16Wrong answer2ms3664 KiB
subtask40/32
17Accepted4ms3868 KiB
18Accepted4ms3860 KiB
19Accepted4ms3864 KiB
20Accepted4ms3984 KiB
21Accepted4ms3880 KiB
22Accepted4ms3868 KiB
23Wrong answer4ms3880 KiB
24Wrong answer4ms3884 KiB
subtask50/44
25Accepted104ms12280 KiB
26Accepted104ms12536 KiB
27Accepted104ms12540 KiB
28Accepted104ms12536 KiB
29Accepted104ms12536 KiB
30Accepted104ms12544 KiB
31Accepted104ms12544 KiB
32Accepted105ms12632 KiB
33Accepted108ms12980 KiB
34Accepted107ms12760 KiB
35Accepted108ms12752 KiB
36Wrong answer104ms12224 KiB
37Wrong answer104ms12164 KiB