Submission #989903

#TimeUsernameProblemLanguageResultExecution timeMemory
989903qwerasdfzxclHotter Colder (IOI10_hottercolder)C++17
88.89 / 100
390 ms8048 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; mt19937 rng(1557); int HC(int N){ ll l = 1, r = N, p = -1; while(l<r){ bool flagL = (p<=l && r+l-p<=N); bool flagR = (p>=r && r+l-p>=1); if (!flagL && !flagR){ if (r==N) p = l, Guess(p), flagL = true; else if (l==1) p = r, Guess(p), flagR = true; else if (rng()&1) p = l, Guess(p), flagL = true; else p = r, Guess(p), flagR = true; } int ret; if (flagL){ p = r+l-p, ret = Guess(p); if (ret==0) return (l+r) / 2; else if (ret==1) l = (l+r) / 2 + 1; else r = (l+r-1) / 2; } else{ p = r+l-p, ret = Guess(p); if (ret==0) return (l+r) / 2; else if (ret==-1) l = (l+r) / 2 + 1; else r = (l+r-1) / 2; } } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...