QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#199642#7346. FrogsRd_rainydays#WA 0ms3920kbC++14571b2023-10-04 13:29:242023-10-04 13:29:24

Judging History

你现在查看的是最新测评结果

  • [2023-10-04 13:29:24]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3920kb
  • [2023-10-04 13:29:24]
  • 提交

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"