#include <iostream>
#include <vector>
#include <queue>
using namespace std;
void output_vector(vector<int> vec, bool isEnterSeperated) {
for (size_t i = 0; i < vec.size(); i++)
{
cout << vec[i];
if (isEnterSeperated) {
cout << "\n";
}
else {
cout << " ";
}
}
}
int main()
{
int n;
cin >> n;
vector<int> res(n,-1);
vector<int> inp(n);
vector<bool> app(2*n);
int old = -1;
for (size_t i = 0; i < n; i++)
{
cin >> inp[i];
if (inp[i] > i + 1 || inp[i]<old) {
cout << "NEM";
return 0;
}
app[inp[i]] = true;
if (inp[i] != old) {
res[i] = old;
}
old = inp[i];
}
int l = 0;
for (size_t i = 0; i < res.size(); i++)
{
if (res[i] == -1) {
for (size_t j = l; j < app.size(); j++)
{
if (!app[j]) {
l = j;
break;
}
}
res[i] = l;
l++;
}
}
cout << "IGEN\n";
output_vector(res, false);
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2060 KiB | ||||
subtask2 | 8/8 | ||||||
3 | Accepted | 2ms | 2136 KiB | ||||
4 | Accepted | 3ms | 2392 KiB | ||||
5 | Accepted | 3ms | 2456 KiB | ||||
6 | Accepted | 3ms | 2636 KiB | ||||
7 | Accepted | 2ms | 2744 KiB | ||||
8 | Accepted | 2ms | 2812 KiB | ||||
9 | Accepted | 3ms | 2952 KiB | ||||
10 | Accepted | 2ms | 3040 KiB | ||||
11 | Accepted | 2ms | 3036 KiB | ||||
subtask3 | 16/16 | ||||||
12 | Accepted | 2ms | 3036 KiB | ||||
13 | Accepted | 2ms | 3060 KiB | ||||
14 | Accepted | 2ms | 3036 KiB | ||||
15 | Accepted | 2ms | 3036 KiB | ||||
16 | Accepted | 3ms | 3160 KiB | ||||
subtask4 | 32/32 | ||||||
17 | Accepted | 4ms | 3328 KiB | ||||
18 | Accepted | 6ms | 3592 KiB | ||||
19 | Accepted | 4ms | 3620 KiB | ||||
20 | Accepted | 4ms | 3540 KiB | ||||
21 | Accepted | 4ms | 3540 KiB | ||||
22 | Accepted | 6ms | 3804 KiB | ||||
23 | Accepted | 4ms | 4004 KiB | ||||
24 | Accepted | 4ms | 4208 KiB | ||||
subtask5 | 44/44 | ||||||
25 | Accepted | 245ms | 16320 KiB | ||||
26 | Accepted | 248ms | 16200 KiB | ||||
27 | Accepted | 246ms | 16196 KiB | ||||
28 | Accepted | 246ms | 16252 KiB | ||||
29 | Accepted | 246ms | 16232 KiB | ||||
30 | Accepted | 248ms | 16232 KiB | ||||
31 | Accepted | 247ms | 16472 KiB | ||||
32 | Accepted | 247ms | 16476 KiB | ||||
33 | Accepted | 247ms | 16532 KiB | ||||
34 | Accepted | 247ms | 16544 KiB | ||||
35 | Accepted | 252ms | 16776 KiB | ||||
36 | Accepted | 143ms | 12688 KiB | ||||
37 | Accepted | 149ms | 12704 KiB |