답안 #356769

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 258 ms 13292 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 259 ms 13420 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 257 ms 13804 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2774 ms 141900 KB Output isn't correct - alpha = 0.000000000000