#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);
ifstream f("be.in");
f >> n;
for(int i = 1; i <= n; i++) {
f >> 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Partially correct | 3ms | 1964 KiB | ||||
2 | Partially correct | 3ms | 2180 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Partially correct | 3ms | 2392 KiB | ||||
4 | Partially correct | 3ms | 2476 KiB | ||||
5 | Partially correct | 3ms | 2668 KiB | ||||
6 | Partially correct | 3ms | 2608 KiB | ||||
7 | Wrong answer | 3ms | 2804 KiB | ||||
8 | Partially correct | 3ms | 3004 KiB | ||||
9 | Partially correct | 3ms | 3228 KiB | ||||
10 | Partially correct | 3ms | 3196 KiB | ||||
11 | Wrong answer | 3ms | 3324 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Partially correct | 3ms | 3524 KiB | ||||
13 | Partially correct | 3ms | 3500 KiB | ||||
14 | Partially correct | 3ms | 3600 KiB | ||||
15 | Wrong answer | 3ms | 3524 KiB | ||||
16 | Wrong answer | 2ms | 3608 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Partially correct | 3ms | 3700 KiB | ||||
18 | Partially correct | 3ms | 3700 KiB | ||||
19 | Partially correct | 3ms | 3736 KiB | ||||
20 | Partially correct | 3ms | 3828 KiB | ||||
21 | Partially correct | 3ms | 3820 KiB | ||||
22 | Partially correct | 2ms | 3828 KiB | ||||
23 | Wrong answer | 2ms | 3968 KiB | ||||
24 | Wrong answer | 2ms | 3936 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Partially correct | 3ms | 3928 KiB | ||||
26 | Partially correct | 3ms | 3908 KiB | ||||
27 | Partially correct | 3ms | 3904 KiB | ||||
28 | Partially correct | 3ms | 4188 KiB | ||||
29 | Partially correct | 3ms | 4128 KiB | ||||
30 | Partially correct | 3ms | 4092 KiB | ||||
31 | Partially correct | 3ms | 4316 KiB | ||||
32 | Partially correct | 3ms | 4192 KiB | ||||
33 | Partially correct | 3ms | 4320 KiB | ||||
34 | Partially correct | 3ms | 4412 KiB | ||||
35 | Partially correct | 3ms | 4652 KiB | ||||
36 | Wrong answer | 3ms | 4728 KiB | ||||
37 | Wrong answer | 3ms | 4600 KiB |