Submission #120195

# Submission time Handle Problem Language Result Execution time Memory
120195 2019-06-23T17:41:02 Z Osama_Alkhodairy Hotter Colder (IOI10_hottercolder) C++17
0 / 100
715 ms 16384 KB
#include <bits/stdc++.h>
#include "grader.h"
//~ #include "grader.cpp"
using namespace std;

int HC(int N){
    if(N == 1) return 1;
    int asked = 0;
    int last = -1;
    auto guess = [&](int x){
        if(x < 1 || x > N) return -1;
        last = x;
        asked++;
        return Guess(x);
    };
    int l = 1, r = N;
    while(l + 1 < r){
        int mid = (l + r) / 2;
        guess(mid - 1);
        int x = guess(mid);
        if(x == -1) r = mid;
        else l = mid;
    }
    if(last == l){
        if(guess(l + 1) == 1) return l + 1;
        return l;
    }
    assert(last == l + 1);
    if(guess(l) == 1) return l;
    return l + 1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 2552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 2552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 2424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 715 ms 16384 KB Execution killed with signal 11 (could be triggered by violating memory limits)