#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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1780 KiB | ||||
2 | Accepted | 3ms | 2080 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 3ms | 2280 KiB | ||||
4 | Accepted | 3ms | 2364 KiB | ||||
5 | Accepted | 3ms | 2684 KiB | ||||
6 | Accepted | 3ms | 2640 KiB | ||||
7 | Wrong answer | 3ms | 2896 KiB | ||||
8 | Accepted | 3ms | 3116 KiB | ||||
9 | Accepted | 3ms | 3060 KiB | ||||
10 | Accepted | 3ms | 3068 KiB | ||||
11 | Wrong answer | 3ms | 3068 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Accepted | 3ms | 3212 KiB | ||||
13 | Accepted | 3ms | 3392 KiB | ||||
14 | Accepted | 3ms | 3724 KiB | ||||
15 | Wrong answer | 3ms | 3936 KiB | ||||
16 | Wrong answer | 3ms | 3772 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Accepted | 4ms | 3960 KiB | ||||
18 | Accepted | 4ms | 4108 KiB | ||||
19 | Accepted | 4ms | 3972 KiB | ||||
20 | Accepted | 4ms | 4084 KiB | ||||
21 | Accepted | 4ms | 4080 KiB | ||||
22 | Accepted | 4ms | 3972 KiB | ||||
23 | Accepted | 3ms | 4092 KiB | ||||
24 | Wrong answer | 4ms | 4312 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Accepted | 104ms | 12808 KiB | ||||
26 | Accepted | 107ms | 13132 KiB | ||||
27 | Accepted | 105ms | 13316 KiB | ||||
28 | Accepted | 105ms | 13304 KiB | ||||
29 | Accepted | 105ms | 13524 KiB | ||||
30 | Accepted | 108ms | 13472 KiB | ||||
31 | Accepted | 107ms | 13496 KiB | ||||
32 | Accepted | 107ms | 13500 KiB | ||||
33 | Accepted | 107ms | 13680 KiB | ||||
34 | Accepted | 108ms | 13716 KiB | ||||
35 | Accepted | 109ms | 13712 KiB | ||||
36 | Accepted | 63ms | 13064 KiB | ||||
37 | Wrong answer | 104ms | 13112 KiB |