Submission #297303

#TimeUsernameProblemLanguageResultExecution timeMemory
297303Bill_00The Big Prize (IOI17_prize)C++14
0 / 100
1 ms360 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){ //cout << mid << ' ' << l << ' ' << r << endl; 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]){ ll++; } if(r0==res[0]){ rr++; } if(rr==0){ if(r==mid+1) return; search(mid+r>>1,mid,r,res[1],r0); } if(ll==0){ if(mid==l+1) 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:31:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |   search(mid+r>>1,mid,r,res[1],r0);
      |          ~~~^~
prize.cpp:35:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   35 |   search(mid+l>>1,l,mid,l1,res[0]);
      |          ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...