Submission #103090

#TimeUsernameProblemLanguageResultExecution timeMemory
103090minson123The Big Prize (IOI17_prize)C++11
20 / 100
63 ms520 KiB
#include<bits/stdc++.h> #include "prize.h" using namespace std; typedef long long ll; typedef pair<int,int> pii; int pos; vector<int> solve(int l,int r,vector<int> tar){ if(pos!=-1) return vector<int>({0,0}); if(l==r){ vector<int> q=ask(l); if(q[0]==0 && q[1]==0) pos=l; return q; } int mid=(l+r)>>1; vector<int> q=ask(mid+1); if(q[0]==0 && q[1]==0) pos=mid+1; if(pos!=-1) return vector<int>({0,0}); if(q[0]!=tar[0] || q[1]!=tar[1]) tar=solve(mid+1,r,tar); if(pos!=-1) return vector<int>({0,0}); return solve(l,mid,tar); } int find_best(int n) { pos=-1; solve(0,n-1,ask(n-1)); if(pos==-1) assert(false); return pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...