QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#199642 | #7346. Frogs | Rd_rainydays# | WA | 0ms | 3920kb | C++14 | 571b | 2023-10-04 13:29:24 | 2023-10-04 13:29:24 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define N 300005
using namespace std;
int sta[N],siz=0;
int n;
int a[N];
int ans[N];
int main(){
scanf("%d",&n);
for(int i=1;i<n;i++)scanf("%d",a+i);
a[n]=0;
for(int i=1;i<=n;i++){
if(a[i]==siz*2){
ans[i]=i;
}
else if(a[i]==siz*2+2){
sta[++siz]=i;
}
else if(a[i]==siz*2-2){
ans[sta[siz]]=i;
ans[i]=sta[siz];
siz--;
}
else {
puts("No");
return 0;
}
}
for(int i=1;i<=n;i++)printf("%d ",ans[i]);puts("");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3920kb
input:
5 2 4 2 2
output:
5 3 2 4 1
result:
wrong answer Line [name=verdict] equals to "5 3 2 4 1 ", doesn't correspond to pattern "Yes|No"