Submission #1012408

#TimeUsernameProblemLanguageResultExecution timeMemory
1012408huutuanHotter Colder (IOI10_hottercolder)C++14
75 / 100
446 ms8240 KiB
#include "grader.h"

#include <bits/stdc++.h>

using namespace std;

mt19937 rng(69420);

int HC(int N){
   int l=1, r=N;
   while (l<=r){
      int mid=(l+r)>>1;
      if (l==r) return mid;
      int m1=(l+r)>>1, m2=(l+r+1)>>1;
      if (m1==m2) --m1, ++m2;
      Guess(m1);
      int t=Guess(m2);
      if (!t) return mid;
      if (r-l+1==3){
         if (t==1) return r;
         return l;
      }
      if (t==1){
         l=m2;
         int t=Guess(r);
         mid=(l+r)>>1;
         if (!t) return mid;
         if (t==1) l=mid+1;
         else r=mid;
      }else{
         r=m2;
         int t=-Guess(l);
         mid=(l+r)>>1;
         if (!t) return mid;
         if (t==1) l=mid+1, r=m1;
         else r=mid;
      }
   }
   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...