Submission #232360

# Submission time Handle Problem Language Result Execution time Memory
232360 2020-05-16T20:08:34 Z crossing0ver Hotter Colder (IOI10_hottercolder) C++17
53 / 100
737 ms 8148 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;
	else x = r;
		
//	x = (l + r)/2;
//	if (x == last) x++;
	ask = Guess(x);    
	}

}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 1236 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 737 ms 8148 KB Output is partially correct - alpha = 0.125000000000