Submission #120201

# Submission time Handle Problem Language Result Execution time Memory
120201 2019-06-23T19:13:42 Z Osama_Alkhodairy Hotter Colder (IOI10_hottercolder) C++17
25 / 100
848 ms 8192 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;
        int las = last;
        int x = guess(mid - 1);
        if(x == -1){
            if(las == l) r = mid;
            else l = mid;
        }
        else{
            int x = guess(mid);
            if(x == -1) r = mid;
            else l = mid;
        }
    }
    guess(l);
    int x = guess(l + 1);
    if(x == 1) return l + 1;
    return l;
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1276 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 848 ms 8192 KB Output isn't correct - alpha = 0.000000000000