104692024-04-03 07:46:31RRoliMexxcpp17Wrong answer 0/100109ms13716 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 < a[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
1Accepted3ms1780 KiB
2Accepted3ms2080 KiB
subtask20/8
3Accepted3ms2280 KiB
4Accepted3ms2364 KiB
5Accepted3ms2684 KiB
6Accepted3ms2640 KiB
7Wrong answer3ms2896 KiB
8Accepted3ms3116 KiB
9Accepted3ms3060 KiB
10Accepted3ms3068 KiB
11Wrong answer3ms3068 KiB
subtask30/16
12Accepted3ms3212 KiB
13Accepted3ms3392 KiB
14Accepted3ms3724 KiB
15Wrong answer3ms3936 KiB
16Wrong answer3ms3772 KiB
subtask40/32
17Accepted4ms3960 KiB
18Accepted4ms4108 KiB
19Accepted4ms3972 KiB
20Accepted4ms4084 KiB
21Accepted4ms4080 KiB
22Accepted4ms3972 KiB
23Accepted3ms4092 KiB
24Wrong answer4ms4312 KiB
subtask50/44
25Accepted104ms12808 KiB
26Accepted107ms13132 KiB
27Accepted105ms13316 KiB
28Accepted105ms13304 KiB
29Accepted105ms13524 KiB
30Accepted108ms13472 KiB
31Accepted107ms13496 KiB
32Accepted107ms13500 KiB
33Accepted107ms13680 KiB
34Accepted108ms13716 KiB
35Accepted109ms13712 KiB
36Accepted63ms13064 KiB
37Wrong answer104ms13112 KiB