Submission #356769

# Submission time Handle Problem Language Result Execution time Memory
356769 2021-01-23T16:12:40 Z Mefarnis Hotter Colder (IOI10_hottercolder) C++14
0 / 100
2774 ms 141900 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

int HC(int n) {
	srand(time(NULL));
	int l = 1 , r = n, guess = -1 , last = -1;
	while(l < r) {
		int mid = (l+r) >> 1;
		if(guess == 1) {
			if(last == l) {
				guess = Guess(r);
				last = r;
				if(guess == 0)
					return mid;
				if((l+r)%2 == 0) {
					if(guess == -1)
						r = mid-1;
					else
						l = mid+1;
				}
				else {
					if(guess == -1)
						r = mid;
					else
						l = mid+1;
				}
			}
			else {
				guess = Guess(l);
				last = l;
				if(guess == 0)
					return mid;
				if((l+r)%2 == 0) {
					if(guess == 1)
						r = mid-1;
					else
						l = mid+1;
				}
				else {
					if(guess == 1)
						r = mid;
					else
						l = mid+1;
				}
			}
		}
		if(guess == -1) {
			if(rand()%2 == 0) {
				Guess(l);
				guess = Guess(r);
				last = r;
				if(guess == 0)
					return mid;
				if((l+r)%2 == 0) {
					if(guess == -1)
						r = mid-1;
					else
						l = mid+1;
				}
				else {
					if(guess == -1)
						r = mid;
					else
						l = mid+1;
				}
			}
			else {
				Guess(r);
				guess = Guess(l);
				last = l;
				if(guess == 0)
					return mid;
				if((l+r)%2 == 0) {
					if(guess == 1)
						r = mid-1;
					else
						l = mid+1;
				}
				else {
					if(guess == 1)
						r = mid;
					else
						l = mid+1;
				}
			}
		}
	}
	return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 13292 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 259 ms 13420 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 257 ms 13804 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2774 ms 141900 KB Output isn't correct - alpha = 0.000000000000