Submission #759525

#TimeUsernameProblemLanguageResultExecution timeMemory
759525Niko_shmikoXylophone (JOI18_xylophone)C++17
0 / 100
1 ms208 KiB
#include "xylophone.h" #include<bits/stdc++.h> void solve(int N){ int mni=0, mxi=0, a[N]; a[0]=0; a[1]=query(1, 2); for(int i=2; i<N; i++){ a[i]=query(i, i+1)+a[i-1]; if((query(i-1, i)==abs(a[i-2]-a[i]))==(a[i-2]>a[i-1])){ a[i]-=a[i-1]; a[i]*=-1; a[i]+=a[i-1]; } } for(int i=0; i<N; i++){ if(a[i]<a[mni]){ mni=i; } if(a[i]>a[mxi]){ mxi=i; } } if(mni>mxi){ mni=-1; }else{ mni=1; } for(int i=0; i<N; i++){ answer(i+1, a[i]*mni+1); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...