Submission #758645

# Submission time Handle Problem Language Result Execution time Memory
758645 2023-06-15T03:32:24 Z SanguineChameleon Hotter Colder (IOI10_hottercolder) C++17
78 / 100
679 ms 8112 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;

mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dist(0, 1);

int HC(int N){
	int lt = 1;
	int rt = N;
	int prv = -1;
	while (lt < rt) {
		int res = -2;
		if (prv == lt) {
			res = Guess(rt);
			prv = rt;
		}
		else if (prv == rt) {
			res = -Guess(lt);
			prv = lt;
		}
		else if (dist(gen) == 0) {
			Guess(lt);
			res = Guess(rt);
			prv = rt;
		}
		else {
			Guess(rt);
			res = -Guess(lt);
			prv = lt;
		}
		if (res == 0) {
			return (lt + rt) / 2;
		}
		if (res == 1) {
			lt = (lt + rt) / 2 + 1;
		}
		else {
			rt = (lt + rt - 1) / 2;
		}
	}
	return lt;
}
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 679 ms 8112 KB Output is partially correct - alpha = 0.137931034483