10612 | 2024-04-06 15:12:22 | Ablablabla | Mexx | cpp17 | Accepted 100/100 | 257ms | 16872 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> szamok(n);
for(int i = 0; i < n; i++){
cin >> szamok[i];
}
for(int i = 0; i < n; i++){
if(szamok[i] > i + 1){
cout << "NEM\n";
return 0;
}
}
for(int i = 1; i < n; i++){
if(szamok[i - 1] > szamok[i]){
cout << "NEM\n";
return 0;
}
}
cout << "IGEN\n";
vector<bool> foglalt(2 * n + 1, 0);
if(szamok[0] != 0) foglalt[0] = 1;
for(int i = 1; i < n; i++){
if(szamok[i - 1] != szamok[i]){
foglalt[szamok[i - 1]] = 1;
}
}
foglalt[szamok[n - 1]] = 1;
vector<int> szabad;
for(int i = 0; i <= 2 * n; i++){
if(!foglalt[i]){
szabad.push_back(i);
}
}
int ind = 0;
if(szamok[0] == 0){
cout << szabad[ind] << " ";
ind++;
} else{
cout << "0 ";
}
for(int i = 1; i < n; i++){
if(szamok[i - 1] != szamok[i]){
cout << szamok[i - 1] << " ";
} else{
cout << szabad[ind] << " ";
ind++;
}
}
cout << "\n";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1684 KiB | ||||
2 | Accepted | 3ms | 1936 KiB | ||||
subtask2 | 8/8 | ||||||
3 | Accepted | 3ms | 2172 KiB | ||||
4 | Accepted | 3ms | 2284 KiB | ||||
5 | Accepted | 3ms | 2692 KiB | ||||
6 | Accepted | 3ms | 2648 KiB | ||||
7 | Accepted | 3ms | 2864 KiB | ||||
8 | Accepted | 3ms | 2948 KiB | ||||
9 | Accepted | 3ms | 3192 KiB | ||||
10 | Accepted | 3ms | 3272 KiB | ||||
11 | Accepted | 2ms | 3276 KiB | ||||
subtask3 | 16/16 | ||||||
12 | Accepted | 3ms | 3272 KiB | ||||
13 | Accepted | 2ms | 3220 KiB | ||||
14 | Accepted | 2ms | 3224 KiB | ||||
15 | Accepted | 2ms | 3220 KiB | ||||
16 | Accepted | 2ms | 3220 KiB | ||||
subtask4 | 32/32 | ||||||
17 | Accepted | 4ms | 3496 KiB | ||||
18 | Accepted | 4ms | 3500 KiB | ||||
19 | Accepted | 4ms | 3500 KiB | ||||
20 | Accepted | 4ms | 3492 KiB | ||||
21 | Accepted | 6ms | 3488 KiB | ||||
22 | Accepted | 6ms | 3620 KiB | ||||
23 | Accepted | 4ms | 3268 KiB | ||||
24 | Accepted | 4ms | 3276 KiB | ||||
subtask5 | 44/44 | ||||||
25 | Accepted | 252ms | 15688 KiB | ||||
26 | Accepted | 252ms | 15932 KiB | ||||
27 | Accepted | 254ms | 15880 KiB | ||||
28 | Accepted | 252ms | 16128 KiB | ||||
29 | Accepted | 254ms | 16340 KiB | ||||
30 | Accepted | 254ms | 16684 KiB | ||||
31 | Accepted | 256ms | 16548 KiB | ||||
32 | Accepted | 256ms | 16768 KiB | ||||
33 | Accepted | 252ms | 16824 KiB | ||||
34 | Accepted | 254ms | 16872 KiB | ||||
35 | Accepted | 257ms | 16804 KiB | ||||
36 | Accepted | 177ms | 8400 KiB | ||||
37 | Accepted | 174ms | 8396 KiB |