#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];
for(int i = 1; i <= n; i++) cout << b[i] << ' ';
cout << endl;
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 | Wrong answer | 3ms | 1872 KiB | ||||
2 | Wrong answer | 3ms | 2184 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Wrong answer | 3ms | 2276 KiB | ||||
4 | Wrong answer | 3ms | 2496 KiB | ||||
5 | Wrong answer | 3ms | 2816 KiB | ||||
6 | Wrong answer | 2ms | 2776 KiB | ||||
7 | Wrong answer | 2ms | 2776 KiB | ||||
8 | Wrong answer | 2ms | 2776 KiB | ||||
9 | Wrong answer | 3ms | 2912 KiB | ||||
10 | Wrong answer | 3ms | 2996 KiB | ||||
11 | Wrong answer | 3ms | 3324 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Wrong answer | 2ms | 3284 KiB | ||||
13 | Wrong answer | 2ms | 3284 KiB | ||||
14 | Wrong answer | 2ms | 3284 KiB | ||||
15 | Wrong answer | 3ms | 3220 KiB | ||||
16 | Wrong answer | 2ms | 3284 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Wrong answer | 4ms | 3760 KiB | ||||
18 | Wrong answer | 4ms | 3724 KiB | ||||
19 | Wrong answer | 4ms | 3608 KiB | ||||
20 | Wrong answer | 4ms | 3564 KiB | ||||
21 | Wrong answer | 4ms | 3572 KiB | ||||
22 | Wrong answer | 4ms | 3572 KiB | ||||
23 | Wrong answer | 4ms | 3440 KiB | ||||
24 | Wrong answer | 4ms | 3564 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Wrong answer | 158ms | 11976 KiB | ||||
26 | Wrong answer | 157ms | 12340 KiB | ||||
27 | Wrong answer | 157ms | 12468 KiB | ||||
28 | Wrong answer | 158ms | 12432 KiB | ||||
29 | Wrong answer | 158ms | 12592 KiB | ||||
30 | Wrong answer | 158ms | 12532 KiB | ||||
31 | Wrong answer | 158ms | 12416 KiB | ||||
32 | Wrong answer | 158ms | 12424 KiB | ||||
33 | Wrong answer | 159ms | 12408 KiB | ||||
34 | Wrong answer | 160ms | 12408 KiB | ||||
35 | Wrong answer | 164ms | 12460 KiB | ||||
36 | Wrong answer | 111ms | 11932 KiB | ||||
37 | Wrong answer | 158ms | 11940 KiB |