Submission #356464

# Submission time Handle Problem Language Result Execution time Memory
356464 2021-01-23T11:57:02 Z Mefarnis Hotter Colder (IOI10_hottercolder) C++14
77 / 100
2870 ms 8196 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

int HC(int n) {
	srand(time(NULL));
	int l = 1 , r = n;
	while(l < r) {
		int mid = (l+r) >> 1;
		if(rand()%2 == 0) {
			Guess(l);
			int val = Guess(r);
			if(val == 0)
				return mid;
			if((l+r)%2 == 0) {
				if(val == -1)
					r = mid-1;
				else
					l = mid+1;
			}
			else {
				if(val == -1)
					r = mid;
				else
					l = mid+1;
			}
		}
		else {
			Guess(r);
			int val = Guess(l);
			if(val == 0)
				return mid;
			if((l+r)%2 == 0) {
				if(val == 1)
					r = mid-1;
				else
					l = mid+1;
			}
			else {
				if(val == 1)
					r = mid;
				else
					l = mid+1;
			}
		}
	}
	return l;
}
# Verdict Execution time Memory Grader output
1 Correct 243 ms 1260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 257 ms 1368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 245 ms 1368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2870 ms 8196 KB Output is partially correct - alpha = 0.068965517241