#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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1776 KiB | ||||
2 | Accepted | 3ms | 2072 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 3ms | 2280 KiB | ||||
4 | Accepted | 3ms | 2360 KiB | ||||
5 | Accepted | 3ms | 2580 KiB | ||||
6 | Accepted | 3ms | 2812 KiB | ||||
7 | Wrong answer | 3ms | 2880 KiB | ||||
8 | Accepted | 2ms | 2744 KiB | ||||
9 | Accepted | 3ms | 2948 KiB | ||||
10 | Accepted | 3ms | 3084 KiB | ||||
11 | Wrong answer | 3ms | 3288 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Accepted | 3ms | 3420 KiB | ||||
13 | Accepted | 3ms | 3764 KiB | ||||
14 | Accepted | 3ms | 3840 KiB | ||||
15 | Wrong answer | 3ms | 3840 KiB | ||||
16 | Wrong answer | 3ms | 3720 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Accepted | 4ms | 3940 KiB | ||||
18 | Accepted | 4ms | 4064 KiB | ||||
19 | Accepted | 4ms | 4148 KiB | ||||
20 | Accepted | 4ms | 4552 KiB | ||||
21 | Accepted | 4ms | 4788 KiB | ||||
22 | Accepted | 4ms | 4816 KiB | ||||
23 | Wrong answer | 4ms | 4796 KiB | ||||
24 | Wrong answer | 4ms | 4992 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Accepted | 119ms | 12704 KiB | ||||
26 | Accepted | 136ms | 12940 KiB | ||||
27 | Accepted | 146ms | 13032 KiB | ||||
28 | Accepted | 158ms | 13284 KiB | ||||
29 | Accepted | 193ms | 14416 KiB | ||||
30 | Accepted | 212ms | 15432 KiB | ||||
31 | Accepted | 234ms | 16260 KiB | ||||
32 | Accepted | 233ms | 16348 KiB | ||||
33 | Accepted | 244ms | 17584 KiB | ||||
34 | Accepted | 268ms | 19340 KiB | ||||
35 | Accepted | 321ms | 25232 KiB | ||||
36 | Wrong answer | 119ms | 12892 KiB | ||||
37 | Wrong answer | 119ms | 13028 KiB |