Submission #319571

# Submission time Handle Problem Language Result Execution time Memory
319571 2020-11-05T14:11:18 Z ehdtjskaqhd Hotter Colder (IOI10_hottercolder) C++17
50 / 100
658 ms 8312 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N)
{
    if (N == 1) return 1;
    int l = 1, r = N, res = -2, lg = -1;
    auto gs = [&](int g) -> int {return Guess(lg = g);};
    while (r > l)
    {
        if (lg == l) res = gs(r);
        else if (lg == r) res = -gs(l);
        else gs(l), res = gs(r);
        if (r - l < 2) break;
        //debug() << imie(l) << imie(r) << imie(res);
        int mid = (l + r) / 2, adj = (l + r) % 2;
        if (!res) return mid;
        else if (~res) l = mid + adj;
        else r = mid;
    }
    return res > 0 ? r : l;
}
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1260 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 658 ms 8312 KB Output isn't correct - alpha = 0.000000000000