Submission #706304

# Submission time Handle Problem Language Result Execution time Memory
706304 2023-03-06T09:15:44 Z SamNguyen Hotter Colder (IOI10_hottercolder) C++14
0 / 100
487 ms 8104 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

const int HOTTER = 1, COLDER = -1, SAME = 0;

template <class Func>
int FIND_SMALLEST(int l, int r, Func f) {
	int res = r + 1;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (f(m)) res = m, r = m - 1;
		else l = m + 1;
	}
	return res;
}

template <class Func>
int FIND_LARGEST(int l, int r, Func f) {
	int res = l - 1;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (f(m)) res = m, l = m + 1;
		else r = m - 1;
	}
	return res;
}

int HC(int N) {
	Guess(1);
	int x = 1, y = N;
	while (x != y) {
		int id = Guess(y);
		if (abs(x - y) == 1) 
			return id == HOTTER ? y : x;

		int m = (x + y) >> 1;

		if (id == SAME)
			return m;

		if (id == HOTTER) {
			x = y;
			y = m;
		}
		else {
			Guess(x);
			y = m;
		}
	}

	return -1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 1300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 487 ms 8104 KB Output isn't correct - alpha = 0.000000000000