Submission #1012399

# Submission time Handle Problem Language Result Execution time Memory
1012399 2024-07-02T05:56:39 Z huutuan Hotter Colder (IOI10_hottercolder) C++14
50 / 100
640 ms 8240 KB
#include "grader.h"

#include <bits/stdc++.h>

using namespace std;

mt19937 rng(69420);

int HC(int N){
   int l=1, r=N;
   int cnt=0;
   int lst=0;
   while (l<=r){
      int mid=(l+r)>>1;
      if (l==r) return mid;
      int t=0;
      if (lst==l){
         t=Guess(r); lst=r;
      }else if (lst==r){
         t=-Guess(l); lst=l;
      }else if (uniform_int_distribution<int>(0, 1)(rng)){
         Guess(l);
         t=Guess(r);
         lst=r;
      }else{
         Guess(r);
         t=-Guess(l);
         lst=l;
      }
      if (!t) return mid;
      if (t==1) l=mid+1;
      else r=mid;
   }
   return -1;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:11:8: warning: unused variable 'cnt' [-Wunused-variable]
   11 |    int cnt=0;
      |        ^~~
# Verdict Execution time Memory Grader output
1 Correct 25 ms 7000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 6744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 640 ms 8240 KB Output isn't correct - alpha = 0.000000000000
2 Halted 0 ms 0 KB -