Submission #99412

#TimeUsernameProblemLanguageResultExecution timeMemory
99412figter001Hotter Colder (IOI10_hottercolder)C++17
83 / 100
927 ms8272 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; ll l,r,res,ans; void calc(ll lst){ // cout << l << ' ' << r << endl; if(l >= r){ ans = l; return; } ll md1 = l + (r - l) / 3; ll 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; ll md1 = l + (r - l) / 3; Guess(md1); calc(md1); 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...