Submission #111251

#TimeUsernameProblemLanguageResultExecution timeMemory
111251aleksamiXylophone (JOI18_xylophone)C++14
0 / 100
3 ms384 KiB
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; void solve(int n) { int a[n+1]; int l = 1; int r = n; bool moze_desno=true; bool moze_levo=true; while(1) { if(r-l==2)break; if(moze_desno) { if(query(l,r-1)==n-1) { r--; continue; } else { moze_desno=false; continue; } } else if(moze_levo) { if(query(l+1,r)==n-1) { l++; continue; } else { moze_levo=false; continue; } } else break; } a[l]=1; a[r]=n; for(int i = l-1; i >= 1; i--) { a[i]=abs(query(i,i+1)-a[i+1]); } for(int i = l+1; i < r; i++) { a[i]=abs(query(i,i-1)-a[i-1]); } for(int i = r+1; i <= n; i++) { a[i]=abs(query(i,i-1)-a[i-1]); } for(int 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...