#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);
}
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);
}
}
for (int sz : veg) {
cout << sz << " ";
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 2016 KiB | ||||
2 | Wrong answer | 3ms | 2160 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Runtime error | 3ms | 2100 KiB | ||||
4 | Wrong answer | 3ms | 2288 KiB | ||||
5 | Wrong answer | 3ms | 2520 KiB | ||||
6 | Wrong answer | 2ms | 2500 KiB | ||||
7 | Accepted | 2ms | 2512 KiB | ||||
8 | Runtime error | 3ms | 2644 KiB | ||||
9 | Wrong answer | 3ms | 2820 KiB | ||||
10 | Wrong answer | 3ms | 2996 KiB | ||||
11 | Accepted | 3ms | 3176 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Wrong answer | 3ms | 3396 KiB | ||||
13 | Wrong answer | 3ms | 3476 KiB | ||||
14 | Wrong answer | 3ms | 3604 KiB | ||||
15 | Accepted | 3ms | 3816 KiB | ||||
16 | Accepted | 3ms | 3932 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Wrong answer | 4ms | 4408 KiB | ||||
18 | Wrong answer | 4ms | 4324 KiB | ||||
19 | Wrong answer | 4ms | 4328 KiB | ||||
20 | Wrong answer | 6ms | 4220 KiB | ||||
21 | Wrong answer | 6ms | 4476 KiB | ||||
22 | Wrong answer | 4ms | 4484 KiB | ||||
23 | Accepted | 4ms | 4436 KiB | ||||
24 | Accepted | 4ms | 4624 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Wrong answer | 244ms | 14304 KiB | ||||
26 | Wrong answer | 245ms | 14232 KiB | ||||
27 | Wrong answer | 246ms | 14180 KiB | ||||
28 | Wrong answer | 246ms | 14164 KiB | ||||
29 | Wrong answer | 246ms | 16316 KiB | ||||
30 | Wrong answer | 247ms | 16348 KiB | ||||
31 | Wrong answer | 246ms | 16680 KiB | ||||
32 | Wrong answer | 250ms | 16812 KiB | ||||
33 | Wrong answer | 248ms | 16904 KiB | ||||
34 | Wrong answer | 247ms | 17320 KiB | ||||
35 | Wrong answer | 250ms | 17812 KiB | ||||
36 | Accepted | 179ms | 9000 KiB | ||||
37 | Accepted | 179ms | 8876 KiB |