Submission #1045495

#TimeUsernameProblemLanguageResultExecution timeMemory
1045495tamir1Xylophone (JOI18_xylophone)C++17
0 / 100
0 ms344 KiB
#include<bits/stdc++.h> #include "xylophone.h" using namespace std; static int A[5000]; void solve(int N) { int l=1,r=N,mid,i,mx=1,idx=0; while(r>l){ mid=(r+l+1)/2; if(query(mid,N)==N-1) l=mid; else r=mid-1; } answer(l,1); for(i=l+1;i<=N;i++){ int x=query(l,i),y; if(x>=mx){ answer(i,x+1); mx=x+1; idx=i; } else{ y=query(idx,i); answer(i,mx-y); } } }

Compilation message (stderr)

xylophone.cpp:4:12: warning: 'A' defined but not used [-Wunused-variable]
    4 | static int A[5000];
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...