제출 #103098

#제출 시각아이디문제언어결과실행 시간메모리
103098minson123커다란 상품 (IOI17_prize)C++11
20 / 100
43 ms436 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==-1) pos=l; return q; } int mid=(l+r)>>1; vector<int> q=ask(mid+1); if(q[0]==0 && q[1]==0 && pos==-1) 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; vector<int> q=ask(n-1); if(q[0]==0 && q[1]==0) return n-1; solve(0,n-1,ask(n-1)); return pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...