#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> szamok;
vector<int> valt;
bool vege=false;
for (int i=0; i<n; i++) {
int x;
cin >> x;
szamok.push_back(x);
if (szamok[i]>i+1) {
vege=true;
}
}
if (vege==true) {
cout << "NEM\n";
return 0;
}
for (int i=1; i<n; i++) {
if (szamok[i]<szamok[i-1]) {
cout << "NEM\n";
return 0;
}
if (szamok[i]>szamok[i-1]) {
valt.push_back(szamok[i]);
}
}
int epp=0;
vector<int> veg;
int y=0;
if (szamok[0]==0) {
epp++;
while (valt.size()>y && epp==valt[y]) {
epp++;
y++;
}
veg.push_back(epp);
}
else {
veg.push_back(epp);
epp++;
}
for (int i=1; i<n; i++) {
if (szamok[i]>szamok[i-1]) {
veg.push_back(szamok[i-1]);
}
else {
epp++;
while (valt.size()>y && epp==valt[y]) {
epp++;
y++;
}
veg.push_back(epp);
}
}
cout << "IGEN\n";
for (int sz : veg) {
cout << sz << " ";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
subtask2 | 8/8 | ||||||
3 | Accepted | 3ms | 2296 KiB | ||||
4 | Accepted | 3ms | 2784 KiB | ||||
5 | Accepted | 3ms | 2588 KiB | ||||
6 | Accepted | 3ms | 2640 KiB | ||||
7 | Accepted | 3ms | 2824 KiB | ||||
8 | Accepted | 3ms | 2964 KiB | ||||
9 | Accepted | 3ms | 3176 KiB | ||||
10 | Accepted | 3ms | 3268 KiB | ||||
11 | Accepted | 3ms | 3388 KiB | ||||
subtask3 | 16/16 | ||||||
12 | Accepted | 3ms | 3488 KiB | ||||
13 | Accepted | 3ms | 3600 KiB | ||||
14 | Accepted | 3ms | 3852 KiB | ||||
15 | Accepted | 3ms | 3920 KiB | ||||
16 | Accepted | 3ms | 4068 KiB | ||||
subtask4 | 32/32 | ||||||
17 | Accepted | 6ms | 4436 KiB | ||||
18 | Accepted | 6ms | 4612 KiB | ||||
19 | Accepted | 4ms | 4568 KiB | ||||
20 | Accepted | 4ms | 4568 KiB | ||||
21 | Accepted | 6ms | 4824 KiB | ||||
22 | Accepted | 6ms | 4780 KiB | ||||
23 | Accepted | 4ms | 4736 KiB | ||||
24 | Accepted | 4ms | 4928 KiB | ||||
subtask5 | 44/44 | ||||||
25 | Accepted | 246ms | 14788 KiB | ||||
26 | Accepted | 247ms | 14824 KiB | ||||
27 | Accepted | 246ms | 14744 KiB | ||||
28 | Accepted | 247ms | 14844 KiB | ||||
29 | Accepted | 248ms | 17032 KiB | ||||
30 | Accepted | 246ms | 16948 KiB | ||||
31 | Accepted | 246ms | 17012 KiB | ||||
32 | Accepted | 247ms | 17016 KiB | ||||
33 | Accepted | 250ms | 17020 KiB | ||||
34 | Accepted | 250ms | 17336 KiB | ||||
35 | Accepted | 254ms | 17864 KiB | ||||
36 | Accepted | 181ms | 9040 KiB | ||||
37 | Accepted | 179ms | 9092 KiB |