Submission #232362

# Submission time Handle Problem Language Result Execution time Memory
232362 2020-05-16T20:12:38 Z crossing0ver Hotter Colder (IOI10_hottercolder) C++17
53 / 100
750 ms 8184 KB
#include<bits/stdc++.h>
#include "grader.h"
using namespace std;


int HC(int N){
	if (N == 1) return 1;
	int m = N/2;
	Guess(N);
	int ask,last = N;
	int l = 1, r = N;
	int x = m;
	ask = Guess(x);
	while (l != r)
	{
		
	if (ask == 0) {
		return (last + x)/2;		
	}
	if (ask == 1) {
		if (last < x)
		l = max(l,(last + x)/2 + 1);
		else r = min(r,(x + last - 1)/2);
	}
	else {
		if (last < x) 
		r = min(r,(last + x - 1)/2);
		else l = max(l,(x + last)/2 + 1);
	}
	if (l == r) return l;
	last = x;
	if (last - l >= r - last) x = (l + last)/2;
	else x = (r + last + 1)/2;
//	x = (l + r)/2;
	ask = Guess(x);    
	}

}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1372 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 750 ms 8184 KB Output is partially correct - alpha = 0.111111111111