Submission #56123

# Submission time Handle Problem Language Result Execution time Memory
56123 2018-07-10T05:03:23 Z leejseo Hotter Colder (IOI10_hottercolder) C++
25 / 100
814 ms 8312 KB
#include "grader.h"
#include <stdio.h>
#include <algorithm>
int HC(int N){
	int lo = 1, hi = N;	
	while (lo < hi){		
		if (hi == lo + 1){			
			Guess(lo);
			if (Guess(hi) == 1) return hi;
			return lo;
		}
		int mid = (lo + hi) >> 1;		
		int left = Guess(lo);
		int middle = Guess(mid);		
		if (middle == -1){
			hi = mid;
			continue;
		}
		if (middle == 0){
			return (lo+mid) >> 1;
		}
		
		int right = Guess(hi);

		//middle == 1
		if (right == 1){
			lo = mid;
			continue;
		}
		if (right == 0){
			return (mid+hi)>>1;
		}
		if (right == -1){
			lo = std::max(lo+1, ((lo + mid) >> 1));
			hi = std::max(lo+1, ((hi + mid) >> 1));
			continue;
		}
	}	
	return lo;
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:13:7: warning: unused variable 'left' [-Wunused-variable]
   int left = Guess(lo);
       ^~~~
# Verdict Execution time Memory Grader output
1 Correct 30 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 814 ms 8312 KB Output isn't correct - alpha = 0.000000000000