#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(a) a.begin(),a.end()
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n;
cin>>n;
vector<int> v(n);
vector<int> ans(n, -1);
bool pos=true;
vector<bool> has(2*n+1, false);
for (int i=0;i<n;i++){
cin>>v[i];
if (i && v[i]<v[i-1]) pos=false;
if (i && v[i]!=v[i-1]) ans[i]=v[i-1];
has[v[i]]=true;
}
if (!pos){
cout<<"NEM";
return 0;
}
int cur=0;
for (int i=0;i<n;i++){
while (has[cur] && cur<=2*n) cur++;
if (cur>2*n) cur=2*n;
if (ans[i]==-1) {
ans[i]=cur;
cur++;
}
}
cur=0;
vector<bool> other(2*n+1,false);
for (int i=0;i<n;i++){
other[ans[i]]=true;
while(other[cur] && cur<=2*n) cur++;
if (cur!=v[i]) pos=false;
}
if (pos){
cout<<"IGEN\n";
for (int i : ans) cout<<i<<" ";
}
else {
cout<<"NEM";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1700 KiB | ||||
2 | Accepted | 3ms | 1936 KiB | ||||
subtask2 | 8/8 | ||||||
3 | Accepted | 3ms | 2136 KiB | ||||
4 | Accepted | 3ms | 2228 KiB | ||||
5 | Accepted | 3ms | 2156 KiB | ||||
6 | Accepted | 3ms | 2288 KiB | ||||
7 | Accepted | 3ms | 2520 KiB | ||||
8 | Accepted | 3ms | 2596 KiB | ||||
9 | Accepted | 3ms | 2728 KiB | ||||
10 | Accepted | 3ms | 2940 KiB | ||||
11 | Accepted | 3ms | 3148 KiB | ||||
subtask3 | 16/16 | ||||||
12 | Accepted | 3ms | 3232 KiB | ||||
13 | Accepted | 3ms | 3228 KiB | ||||
14 | Accepted | 3ms | 3460 KiB | ||||
15 | Accepted | 3ms | 3444 KiB | ||||
16 | Accepted | 3ms | 3696 KiB | ||||
subtask4 | 32/32 | ||||||
17 | Accepted | 4ms | 3912 KiB | ||||
18 | Accepted | 4ms | 4124 KiB | ||||
19 | Accepted | 4ms | 4064 KiB | ||||
20 | Accepted | 4ms | 3952 KiB | ||||
21 | Accepted | 4ms | 3948 KiB | ||||
22 | Accepted | 4ms | 3972 KiB | ||||
23 | Accepted | 3ms | 3964 KiB | ||||
24 | Accepted | 3ms | 3996 KiB | ||||
subtask5 | 44/44 | ||||||
25 | Accepted | 116ms | 12220 KiB | ||||
26 | Accepted | 115ms | 12160 KiB | ||||
27 | Accepted | 115ms | 12264 KiB | ||||
28 | Accepted | 116ms | 12348 KiB | ||||
29 | Accepted | 116ms | 12408 KiB | ||||
30 | Accepted | 116ms | 12308 KiB | ||||
31 | Accepted | 119ms | 12372 KiB | ||||
32 | Accepted | 119ms | 12552 KiB | ||||
33 | Accepted | 119ms | 12532 KiB | ||||
34 | Accepted | 120ms | 12796 KiB | ||||
35 | Accepted | 123ms | 12844 KiB | ||||
36 | Accepted | 70ms | 12684 KiB | ||||
37 | Accepted | 64ms | 12548 KiB |