Submission #989903

# Submission time Handle Problem Language Result Execution time Memory
989903 2024-05-29T00:32:03 Z qwerasdfzxcl Hotter Colder (IOI10_hottercolder) C++17
88.8889 / 100
390 ms 8048 KB
#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 time Memory Grader output
1 Correct 17 ms 7000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 390 ms 8048 KB Output is partially correct - alpha = 0.555555555556