Submission #310967

# Submission time Handle Problem Language Result Execution time Memory
310967 2020-10-08T22:21:17 Z LucaDantas Hotter Colder (IOI10_hottercolder) C++17
52 / 100
753 ms 8312 KB
#include "grader.h"
#include<cassert>
#include<cstdio>

int guess(int a, int b) {
	Guess(a);
	return Guess(b);
}

int HC(int n){
	int l = 1, r = n;
	int cnt = 0;
	while(r - l > 3) {
		int ans = guess(l, r);
		if(!ans) {/*assert(cnt < 18);*/ return (l+r) >> 1;}
		if(ans == 1) l = (l+r+1) >> 1;
		else r = (l+r-1) >> 1;
		cnt += 2;
	}
	// assert(cnt <= 14);
	// printf("%d\n", cnt);
	if(r == l) return l;
	if(r-l == 1)
		return guess(l, r)==1?r:l;
	if(r - l == 2) {
		int ans = guess(l, r);
		return ans==1?r:ans==0?l+1:l;
	}
	if(r - l == 3) {
		int ans = guess(l, r-1);
		if(ans == 0) return l+1;
		if(ans == -1) return l;
		if(Guess(r) == 1) return r;
		// printf("%d\n", cnt+3);
		return r-1;
	}
}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 1280 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 753 ms 8312 KB Output is partially correct - alpha = 0.068965517241