Submission #1018832

#TimeUsernameProblemLanguageResultExecution timeMemory
1018832vjudge1The Big Prize (IOI17_prize)C++17
20 / 100
53 ms1200 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; #define lli long long int int find_best(int n){ vector<int>a(2); vector<int>vb(n,0); int x=0,y=n-1,z,xx=0,yy=n-1,p; int c=9877; while(x!=y){ z=(xx+yy)/2; p=z; if(vb[z]){ z++; while(vb[z]){ z++; if(z>yy){ z=xx; } } if(p==z){ if(yy==y){ y=xx+1; yy=y; } if(xx==x){ x=yy-1; xx=x; } z=xx; while(vb[z]){ x++; xx++; z++; } } } a=ask(z); vb[z]=1; if(a[0]+a[1]==0){ return z; } else if(a[1]+a[0]==1){ if(a[1]){ x=z+1; } else{ y=z-1; } xx=x; yy=y; } else{ a[0]=(9347*c)%a[0]; a[1]=(9347*c)%a[1]; if(a[0]>a[1]){ xx=x; yy=z-1; } else{ xx=z+1; yy=y; } } } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...