Submission #289787

#TimeUsernameProblemLanguageResultExecution timeMemory
289787Bill_00The Big Prize (IOI17_prize)C++14
0 / 100
1 ms256 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; int ans,m; int p[200001]={0}; void search(int mid,int l,int r,int l1,int r0){ int ll=0,rr=0; vector<int>res=ask(mid); if(res[0]+res[1]==0){ ans=mid; return; } if(l==r){ return; } if(res[0]==0){ ll++; } if(res[1]==0){ rr++; } if(l1==res[1]){ rr++; } if(r0==res[0]){ ll++; } if(rr==0){ if(l+1==mid) return; search(mid+r>>1,mid,r,res[1],r0); } if(ll==0){ if(mid+1==r) return; search(mid+l>>1,l,mid,l1,res[0]); } } int find_best(int n){ m=n; /*for(int i = 0; i < n; i++) { std::vector<int> res = ask(i); if(res[0] + res[1] == 0) return i; }*/ int l=0,r=n-1; int mid=(l+r)>>1; vector<int>lll=ask(l); vector<int>rrr=ask(r); search(mid,l,r,lll[1],rrr[0]); return ans; }

Compilation message (stderr)

prize.cpp: In function 'void search(int, int, int, int, int)':
prize.cpp:30:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |   search(mid+r>>1,mid,r,res[1],r0);
      |          ~~~^~
prize.cpp:34:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |   search(mid+l>>1,l,mid,l1,res[0]);
      |          ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...