Submission #232364

# Submission time Handle Problem Language Result Execution time Memory
232364 2020-05-16T20:19:59 Z crossing0ver Hotter Colder (IOI10_hottercolder) C++17
54 / 100
786 ms 8272 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;
	x = (l + r - last)/2;
	if (x < l) x = (l + r)/2;
	if (x == last ) x++; 
	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 30 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1280 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 786 ms 8272 KB Output is partially correct - alpha = 0.142857142857