Submission #402015

# Submission time Handle Problem Language Result Execution time Memory
402015 2021-05-11T07:41:59 Z phathnv Hotter Colder (IOI10_hottercolder) C++11
0 / 100
614 ms 8176 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 + 1;
            else
                r = mid - 1;
        } else {
            if (x == 1)
                r = mid + 1;
            else
                l = mid - 1;
        }
        pre = nxt;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 1356 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 1352 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 614 ms 8176 KB Output isn't correct - alpha = 0.000000000000