104722024-04-03 07:52:02RRoliMexxcpp17Wrong answer 0/100119ms13288 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);
    ifstream f("be.in");

    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++;
        }
        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
1Accepted3ms2108 KiB
2Accepted3ms2452 KiB
subtask20/8
3Accepted2ms2272 KiB
4Accepted3ms2292 KiB
5Accepted3ms2612 KiB
6Accepted3ms2832 KiB
7Wrong answer3ms2908 KiB
8Accepted3ms3012 KiB
9Accepted2ms3008 KiB
10Accepted3ms3160 KiB
11Wrong answer2ms3104 KiB
subtask30/16
12Accepted3ms3320 KiB
13Accepted2ms3180 KiB
14Accepted2ms3260 KiB
15Wrong answer3ms3516 KiB
16Wrong answer3ms3652 KiB
subtask40/32
17Accepted4ms3920 KiB
18Accepted4ms3908 KiB
19Accepted4ms4036 KiB
20Accepted4ms4112 KiB
21Accepted4ms3948 KiB
22Accepted4ms3848 KiB
23Accepted4ms4076 KiB
24Wrong answer4ms4156 KiB
subtask50/44
25Accepted115ms12520 KiB
26Accepted115ms12800 KiB
27Accepted116ms12864 KiB
28Accepted116ms12804 KiB
29Accepted115ms12812 KiB
30Accepted116ms12804 KiB
31Accepted116ms12912 KiB
32Accepted119ms12996 KiB
33Accepted116ms13076 KiB
34Accepted119ms13208 KiB
35Accepted119ms13288 KiB
36Accepted70ms12588 KiB
37Wrong answer115ms12676 KiB