#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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2108 KiB | ||||
2 | Accepted | 3ms | 2452 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 2ms | 2272 KiB | ||||
4 | Accepted | 3ms | 2292 KiB | ||||
5 | Accepted | 3ms | 2612 KiB | ||||
6 | Accepted | 3ms | 2832 KiB | ||||
7 | Wrong answer | 3ms | 2908 KiB | ||||
8 | Accepted | 3ms | 3012 KiB | ||||
9 | Accepted | 2ms | 3008 KiB | ||||
10 | Accepted | 3ms | 3160 KiB | ||||
11 | Wrong answer | 2ms | 3104 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Accepted | 3ms | 3320 KiB | ||||
13 | Accepted | 2ms | 3180 KiB | ||||
14 | Accepted | 2ms | 3260 KiB | ||||
15 | Wrong answer | 3ms | 3516 KiB | ||||
16 | Wrong answer | 3ms | 3652 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Accepted | 4ms | 3920 KiB | ||||
18 | Accepted | 4ms | 3908 KiB | ||||
19 | Accepted | 4ms | 4036 KiB | ||||
20 | Accepted | 4ms | 4112 KiB | ||||
21 | Accepted | 4ms | 3948 KiB | ||||
22 | Accepted | 4ms | 3848 KiB | ||||
23 | Accepted | 4ms | 4076 KiB | ||||
24 | Wrong answer | 4ms | 4156 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Accepted | 115ms | 12520 KiB | ||||
26 | Accepted | 115ms | 12800 KiB | ||||
27 | Accepted | 116ms | 12864 KiB | ||||
28 | Accepted | 116ms | 12804 KiB | ||||
29 | Accepted | 115ms | 12812 KiB | ||||
30 | Accepted | 116ms | 12804 KiB | ||||
31 | Accepted | 116ms | 12912 KiB | ||||
32 | Accepted | 119ms | 12996 KiB | ||||
33 | Accepted | 116ms | 13076 KiB | ||||
34 | Accepted | 119ms | 13208 KiB | ||||
35 | Accepted | 119ms | 13288 KiB | ||||
36 | Accepted | 70ms | 12588 KiB | ||||
37 | Wrong answer | 115ms | 12676 KiB |