Submission #319580

# Submission time Handle Problem Language Result Execution time Memory
319580 2020-11-05T15:22:56 Z ehdtjskaqhd Hotter Colder (IOI10_hottercolder) C++17
0 / 100
796 ms 8292 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N)
{
    int l = 1, r = N, lg = -1;
    auto gs = [&](int g) -> int {return Guess(lg = g);};
    while (r - l > 2)
    {
        int p = (l * 2 + r) / 3, q = (l + r * 2) / 3;
        gs(p);
        int fpq = gs(q);
        if (!fpq) return (p + q) / 2;
        if (~fpq) l = p;
        else r = q;
    }
    if (r - l == 1)
    {
        if (lg == r) swap(l, r);
        return gs(r) ? l : r;
    }
    if (r - l == 2)
    {
        if (lg != r && lg != l)
        {
            if (~gs(r)) return r;
            return l + !gs(l);
        }
        if (lg == r) swap(l, r);
        int res = gs(r);
        if (!res) return (l + r) / 2;
        return ~res ? r : l;
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1260 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1408 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1260 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 796 ms 8292 KB Output isn't correct - alpha = 0.000000000000