#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 (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 (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 | 1816 KiB | ||||
2 | Accepted | 3ms | 2204 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Runtime error | 3ms | 2240 KiB | ||||
4 | Accepted | 2ms | 2240 KiB | ||||
5 | Accepted | 3ms | 2432 KiB | ||||
6 | Accepted | 2ms | 2516 KiB | ||||
7 | Accepted | 2ms | 2512 KiB | ||||
8 | Runtime error | 3ms | 2492 KiB | ||||
9 | Accepted | 3ms | 2648 KiB | ||||
10 | Accepted | 3ms | 2896 KiB | ||||
11 | Accepted | 2ms | 2944 KiB | ||||
subtask3 | 16/16 | ||||||
12 | Accepted | 3ms | 3076 KiB | ||||
13 | Accepted | 2ms | 3156 KiB | ||||
14 | Accepted | 3ms | 3156 KiB | ||||
15 | Accepted | 3ms | 3292 KiB | ||||
16 | Accepted | 3ms | 3500 KiB | ||||
subtask4 | 32/32 | ||||||
17 | Accepted | 6ms | 3692 KiB | ||||
18 | Accepted | 4ms | 3704 KiB | ||||
19 | Accepted | 6ms | 3952 KiB | ||||
20 | Accepted | 6ms | 3968 KiB | ||||
21 | Accepted | 6ms | 4112 KiB | ||||
22 | Accepted | 6ms | 4008 KiB | ||||
23 | Accepted | 4ms | 3960 KiB | ||||
24 | Accepted | 4ms | 4012 KiB | ||||
subtask5 | 44/44 | ||||||
25 | Accepted | 244ms | 13672 KiB | ||||
26 | Accepted | 245ms | 13660 KiB | ||||
27 | Accepted | 245ms | 13660 KiB | ||||
28 | Accepted | 245ms | 13660 KiB | ||||
29 | Accepted | 246ms | 16064 KiB | ||||
30 | Accepted | 246ms | 16084 KiB | ||||
31 | Accepted | 247ms | 16156 KiB | ||||
32 | Accepted | 246ms | 16144 KiB | ||||
33 | Accepted | 250ms | 16400 KiB | ||||
34 | Accepted | 250ms | 16756 KiB | ||||
35 | Accepted | 250ms | 17352 KiB | ||||
36 | Accepted | 175ms | 8484 KiB | ||||
37 | Accepted | 177ms | 8492 KiB |