Submission #99411

#TimeUsernameProblemLanguageResultExecution timeMemory
99411figter001Hotter Colder (IOI10_hottercolder)C++17
75 / 100
903 ms8184 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; int l,r,res,ans; void calc(int lst){ // cout << l << ' ' << r << endl; if(l >= r){ ans = l; return; } int md1 = l + (r - l) / 3; int md2 = r - (r - l) / 3; if(abs(md1 - lst) < abs(md2 - lst)) swap(md1,md2); res = Guess(md1); if(res == 1){ if(lst > md1){ r = min(r,(md1+lst)/2); }else{ l = max(l,(md1+lst)/2+1); } }else if(res == -1){ if(lst > md1){ l = max(l,(md1+lst)/2+1); }else{ r = min(r,(md1+lst)/2); } }else{ ans = (md1+lst)/2; return; } calc(md1); } int HC(int N){ l = 1; r = N; int md1 = l + (r - l) / 3; int md2 = r - (r - l) / 3; Guess(md1); res = Guess(md2); if(res == 1){ l = (md1+md2)/2 + 1; }else if(res == -1){ r = (md1+md2)/2; }else{ return (md1+md2)/2; } calc(md2); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...