Submission #597202

# Submission time Handle Problem Language Result Execution time Memory
597202 2022-07-15T17:26:48 Z skittles1412 Hotter Colder (IOI10_hottercolder) C++17
50 / 100
561 ms 13996 KB
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
    cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t << " | ";
    dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())

int Guess(int G);

int HC(int n) {
    int l = 1, r = n, last = -1;
    auto guess = [&](int x) -> int {
        last = x;
        return Guess(x);
    };
    while (l < r) {
        int res;
        if (l == last) {
            res = guess(r);
        } else if (r == last) {
            res = -guess(l);
        } else {
            guess(l);
            res = guess(r);
        }
        int mid = (l + r) / 2;
        if (res < 0) {
            r = mid;
        } else if (res == 0) {
            return mid;
        } else {
            l = mid + 1;
        }
    }
    return l;
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 561 ms 13996 KB Output isn't correct - alpha = 0.000000000000