104542024-04-02 21:35:52RRoliMexxcpp17Wrong answer 0/100321ms25232 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);

    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> 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
1Accepted3ms1776 KiB
2Accepted3ms2072 KiB
subtask20/8
3Accepted3ms2280 KiB
4Accepted3ms2360 KiB
5Accepted3ms2580 KiB
6Accepted3ms2812 KiB
7Wrong answer3ms2880 KiB
8Accepted2ms2744 KiB
9Accepted3ms2948 KiB
10Accepted3ms3084 KiB
11Wrong answer3ms3288 KiB
subtask30/16
12Accepted3ms3420 KiB
13Accepted3ms3764 KiB
14Accepted3ms3840 KiB
15Wrong answer3ms3840 KiB
16Wrong answer3ms3720 KiB
subtask40/32
17Accepted4ms3940 KiB
18Accepted4ms4064 KiB
19Accepted4ms4148 KiB
20Accepted4ms4552 KiB
21Accepted4ms4788 KiB
22Accepted4ms4816 KiB
23Wrong answer4ms4796 KiB
24Wrong answer4ms4992 KiB
subtask50/44
25Accepted119ms12704 KiB
26Accepted136ms12940 KiB
27Accepted146ms13032 KiB
28Accepted158ms13284 KiB
29Accepted193ms14416 KiB
30Accepted212ms15432 KiB
31Accepted234ms16260 KiB
32Accepted233ms16348 KiB
33Accepted244ms17584 KiB
34Accepted268ms19340 KiB
35Accepted321ms25232 KiB
36Wrong answer119ms12892 KiB
37Wrong answer119ms13028 KiB