6116 | 2023-11-01 18:45:21 | horvathabel | Mexx | cpp17 | Wrong answer 0/100 | 252ms | 24084 KiB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<int> ans(n,-1);
vector<pair<bool,int>> szm={{0,0}};
int x;
cin>>x;
vector<int> a={x};
bool mego=true;
for (int i=1; i<n;i++){
szm.push_back({false,i});
int x;
cin>>x;
a.push_back(x);
if (a[i]!=a[i-1]){
ans[i]=a[i-1];
if (szm.size()>=a[i-1]){
szm[a[i-1]].first=true;
}
else{
mego=false;
}
}
}
szm.push_back({false,n});
szm[a[n-1]].first=true;
if (!mego){
cout<<"NEM\n";
return 0;
}
if (a[0]>1){
cout<<"NEM\n";
return 0;
}
for (int i=n-1;i>=0;i--){
if (ans[i]==-1){
while(!szm.empty() && szm[szm.size()-1].first==1){
szm.pop_back();
}
ans[i]=szm[szm.size()-1].second;
szm.pop_back();
}
}
cout<<"IGEN\n";
for (int x:ans) cout<<x<<" ";
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1812 KiB | ||||
2 | Accepted | 3ms | 2064 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 3ms | 2368 KiB | ||||
4 | Accepted | 3ms | 2544 KiB | ||||
5 | Accepted | 3ms | 2728 KiB | ||||
6 | Accepted | 3ms | 3012 KiB | ||||
7 | Accepted | 3ms | 2892 KiB | ||||
8 | Accepted | 3ms | 3132 KiB | ||||
9 | Accepted | 2ms | 3168 KiB | ||||
10 | Accepted | 3ms | 3288 KiB | ||||
11 | Wrong answer | 3ms | 3408 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Accepted | 3ms | 3508 KiB | ||||
13 | Accepted | 3ms | 3624 KiB | ||||
14 | Accepted | 3ms | 3712 KiB | ||||
15 | Wrong answer | 2ms | 3660 KiB | ||||
16 | Wrong answer | 2ms | 3648 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Accepted | 4ms | 3924 KiB | ||||
18 | Accepted | 6ms | 4056 KiB | ||||
19 | Accepted | 6ms | 4268 KiB | ||||
20 | Accepted | 6ms | 4404 KiB | ||||
21 | Accepted | 6ms | 4420 KiB | ||||
22 | Accepted | 6ms | 4524 KiB | ||||
23 | Wrong answer | 4ms | 4420 KiB | ||||
24 | Wrong answer | 4ms | 4504 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Accepted | 246ms | 23980 KiB | ||||
26 | Accepted | 244ms | 24060 KiB | ||||
27 | Accepted | 245ms | 23932 KiB | ||||
28 | Accepted | 246ms | 23840 KiB | ||||
29 | Accepted | 246ms | 23868 KiB | ||||
30 | Accepted | 252ms | 24032 KiB | ||||
31 | Accepted | 250ms | 24084 KiB | ||||
32 | Accepted | 246ms | 24056 KiB | ||||
33 | Accepted | 246ms | 23864 KiB | ||||
34 | Accepted | 247ms | 23964 KiB | ||||
35 | Accepted | 247ms | 23964 KiB | ||||
36 | Wrong answer | 245ms | 23944 KiB | ||||
37 | Wrong answer | 244ms | 24036 KiB |