Submission #491677

# Submission time Handle Problem Language Result Execution time Memory
491677 2021-12-03T19:01:48 Z dxz05 Hotter Colder (IOI10_hottercolder) C++14
25 / 100
534 ms 8240 KB
#include "grader.h"
#include <bits/stdc++.h>

using namespace std;

int HC(int n){
    if (n == 1) return 1;

    int g = Guess(1);

    int ans = 1;

    int l = 2, r = n;
    while (l <= r){
        int m = (l + r) >> 1;
        g = Guess(m - 1);
        g = Guess(m);

        if (g == 1){
            ans = m;
            l = m + 1;
        } else r = m - 1;
    }

    return l - 1;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:11:9: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   11 |     int ans = 1;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 1228 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1228 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 534 ms 8240 KB Output isn't correct - alpha = 0.000000000000