제출 #599249

#제출 시각아이디문제언어결과실행 시간메모리
599249Ahmadsm2005커다란 상품 (IOI17_prize)C++14
20 / 100
15 ms296 KiB
#include<bits/stdc++.h> #include "prize.h" //#include "grader.cpp" using namespace std; vector<int>GLOB; int find_best(int n){ int CNT=0; for(int i=0;i<min(n,500);i++){ vector<int>R=ask(i); CNT=max(CNT,R[0]+R[1]); } int FOUND=0,LAST=0; while(1){ int L=LAST,R=n-1,mid,BEST=-1; while(1){ vector<int>z=ask(L); if(z[0]+z[1]==0) return L; if(z[0]+z[1]!=CNT) L++; else{ FOUND=z[0]; break; } } while(L<=R){ mid=(L+R)/2; vector<int>z=ask(mid); int A=z[0],B=z[1]; if(A+B!=CNT) BEST=mid; if(A>FOUND) R=mid-1; else if(!A&&!B) return mid; else L=mid+1; } if(BEST==-1) exit(1); LAST=BEST+1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...