Submission #116062

#TimeUsernameProblemLanguageResultExecution timeMemory
116062someone_aaHotter Colder (IOI10_hottercolder)C++17
50 / 100
8080 ms110608 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; int HC(int N){ mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int l = 1, r = N; int lst = 1; Guess(lst); for(int i=0;i<30;i++) { if(l == r) return l; int curr = (l + r) / 2; if(curr == lst) { while(curr == lst) { curr = uniform_int_distribution<int>(l, r)(rng); } } int q = Guess(curr); //cout<<i<<" - Previous was: "<<lst<<"\n"; //cout<<l<<", "<<r<<" - "<<curr<<" --> "<<q<<"\n"; if(curr < lst) { if(q == -1) { int sz = (lst - curr + 1) / 2; int cl = lst - sz + 1; int cr = N; l = max(l,cl); r = min(r,cr); } else if(q == 0) { int mid = (lst + curr) / 2; return mid; } else { int sz = (lst - curr + 1) / 2; int cl = 1; int cr = curr + sz - 1; l = max(l,cl); r = min(r,cr); } } else if(curr > lst) { if(q == -1) { int sz = (curr - lst + 1) / 2; int cl = 1; int cr = lst + sz - 1; l = max(l,cl); r = min(r,cr); } else if(q == 0) { int mid = (lst + curr) / 2; return mid; } else { int sz = (curr - lst + 1) / 2; int cl = curr - sz + 1; int cr = N; l = max(l,cl); r = min(r,cr); } } lst = curr; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...