6115 | 2023-11-01 18:40:53 | horvathabel | Mexx | cpp17 | Wrong answer 0/100 | 254ms | 68428 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";
return 0;
}
if (a[0]>1){
cout<<"NEM";
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 | 1936 KiB | ||||
2 | Accepted | 3ms | 2068 KiB | ||||
subtask2 | 0/8 | ||||||
3 | Accepted | 3ms | 2300 KiB | ||||
4 | Accepted | 3ms | 2492 KiB | ||||
5 | Accepted | 2ms | 2556 KiB | ||||
6 | Accepted | 3ms | 2772 KiB | ||||
7 | Accepted | 3ms | 3136 KiB | ||||
8 | Accepted | 3ms | 3212 KiB | ||||
9 | Accepted | 3ms | 3428 KiB | ||||
10 | Accepted | 3ms | 3640 KiB | ||||
11 | Wrong answer | 3ms | 3728 KiB | ||||
subtask3 | 0/16 | ||||||
12 | Accepted | 3ms | 3736 KiB | ||||
13 | Accepted | 3ms | 3872 KiB | ||||
14 | Accepted | 2ms | 3960 KiB | ||||
15 | Wrong answer | 2ms | 3960 KiB | ||||
16 | Wrong answer | 3ms | 4092 KiB | ||||
subtask4 | 0/32 | ||||||
17 | Accepted | 6ms | 4484 KiB | ||||
18 | Accepted | 4ms | 4480 KiB | ||||
19 | Accepted | 6ms | 4772 KiB | ||||
20 | Accepted | 6ms | 4776 KiB | ||||
21 | Accepted | 6ms | 5132 KiB | ||||
22 | Accepted | 6ms | 5268 KiB | ||||
23 | Wrong answer | 6ms | 5164 KiB | ||||
24 | Wrong answer | 6ms | 5472 KiB | ||||
subtask5 | 0/44 | ||||||
25 | Accepted | 247ms | 28188 KiB | ||||
26 | Accepted | 245ms | 31604 KiB | ||||
27 | Accepted | 245ms | 35020 KiB | ||||
28 | Accepted | 245ms | 38220 KiB | ||||
29 | Accepted | 250ms | 41456 KiB | ||||
30 | Accepted | 254ms | 44868 KiB | ||||
31 | Accepted | 246ms | 48204 KiB | ||||
32 | Accepted | 246ms | 51720 KiB | ||||
33 | Accepted | 246ms | 55144 KiB | ||||
34 | Accepted | 250ms | 58476 KiB | ||||
35 | Accepted | 248ms | 61836 KiB | ||||
36 | Wrong answer | 243ms | 65076 KiB | ||||
37 | Wrong answer | 246ms | 68428 KiB |