Submission #283297

#TimeUsernameProblemLanguageResultExecution timeMemory
283297wildturtleXylophone (JOI18_xylophone)C++14
0 / 100
1 ms256 KiB
#include<bits/stdc++.h> #include "xylophone.h" using namespace std; long long a,b,c,d,i,e,f,g,n,m,k,l,A[5003],minn,maxx,idx,idx1; void solve(int n){ a=query(1,2); A[1]=0; A[2]=a; minn=0; idx=1; maxx=a; idx1=2; for(long long i=3;i<=n;i++) { a=query(i-1,i); b=query(i-2,i); if(A[i-1]>A[i-2]) { if(b==A[i-1]-A[i-2]+a) A[i]=A[i-1]+a; else A[i]=A[i-1]-a; } else { if(b==A[i-2]-A[i-1]+a) A[i]=A[i-1]+a; else A[i]=A[i-1]-a; } if(minn>A[i]) { minn=A[i]; idx=i; } if(maxx<A[i]) { maxx=A[i]; idx1=i; } } if(idx1<idx) { for(long long i=1;i<=n;i++) A[i]=-A[i]; } minn=0; for(long long i=1;i<=n;i++) minn=min(minn,A[i]); for(long long i=1;i<=n;i++) { A[i]-=minn-1; } for(long long i=1;i<=n;i++) { answer(i,A[i]); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...