QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#417250 | #7346. Frogs | unputdownable# | WA | 1ms | 3652kb | C++17 | 1.3kb | 2024-05-22 16:43:05 | 2024-05-22 16:43:06 |
Judging History
answer
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
// #define int long long
#define i64 long long
#define pii pair <int, int>
using namespace std;
inline int read(void) {
int x=0,sgn=1; char ch=getchar();
while(ch<48||57<ch) {if(ch==45)sgn=0;ch=getchar();}
while(47<ch&&ch<58) {x=x*10+ch-48; ch=getchar();}
return sgn? x:-x;
}
void write(int x) {
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
/*
write((Ans%p+p)%p); pls
*/
int n;
int a[200005],v[200005];
int stk[200005],top;
signed main() {
// freopen("localinput","r",stdin);
// freopen("localoutput","w",stdout);
n=read();
for(int i=1; i<n; ++i) v[i]=read();
for(int i=1; i<n; ++i) if(v[i]&1) return puts("No"),0;
for(int i=1; i<n; ++i) v[i]/=2;
for(int i=1; i<=n; ++i) {
if(v[i]==top+1) {
stk[++top]=i;
} else if(v[i]==top) {
a[i]=i;
} else if(v[i]==top-1) {
int b=stk[top]; --top;
a[i]=b;
a[b]=i;
} else return puts("No"),0;
}
for(int i=1; i<=n; ++i) write(a[i]),putchar(" \n"[i==n]);
// fprintf(stderr,"%.4lf\n",1.0*clock()/CLOCKS_PER_SEC);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3652kb
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"