Submission #41053

# Submission time Handle Problem Language Result Execution time Memory
41053 2018-02-12T07:46:17 Z esspks21 Hotter Colder (IOI10_hottercolder) C++14
50 / 100
773 ms 8204 KB
#include "grader.h"
int HC(int N) {
	if (N <= 16) {
		Guess(1);
		for (int i = 2; i <= N; i++)
			if (Guess(i) == -1)
				return i - 1;
		return N;
	}
	int left = 1;
	int right = N;
	while (left <= right) {
		if (left == right)
			return (left + right) / 2;
		if (right - left <= 4)
			break;
		Guess(left);
		int temp = Guess(right);
		if (temp == 0) // same
			return (left + right) / 2;
		if (temp == 1) // hotter
			left = (left + right) / 2 + 1;
		if (temp == -1) // colder
			right = (left + right) / 2;
	}
	Guess(left);
	for (int i = left + 1; i <= right; i++)
		if (Guess(i) == -1)
			return i - 1;
	return right;
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 773 ms 8204 KB Output isn't correct - alpha = 0.000000000000