Submission #402014

# Submission time Handle Problem Language Result Execution time Memory
402014 2021-05-11T07:38:35 Z phathnv Hotter Colder (IOI10_hottercolder) C++11
0 / 100
10000 ms 15172 KB
#include "grader.h"
#include<iostream>

int HC(int n){
    if (n == 1)
        return 0;
    int l, r, mid = (n + 1) / 2, pre = mid + 1;
    Guess(mid);
    if (Guess(mid + 1) == 1)
        l = mid + 1, r = n;
    else
        l = 1, r = mid;
    while (l < r){
        //std::cerr << l << ' ' << r << ' ' << pre << std::endl;
        mid = (l + r) >> 1;
        int nxt = 2 * mid - pre;
        if (nxt < 1)
            nxt = 1;
        if (nxt > n)
            nxt = n;
        mid = (pre + nxt) / 2;
        int x = Guess(nxt);
        if (x == 0)
            return mid;
        if (pre < nxt){
            if (x == 1)
                l = mid;
            else
                r = mid;
        } else {
            if (x == 1)
                r = mid;
            else
                l = mid;
        }
        pre = nxt;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10043 ms 1228 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10045 ms 1228 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10068 ms 1228 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 10087 ms 15172 KB Time limit exceeded