Submission #201506

# Submission time Handle Problem Language Result Execution time Memory
201506 2020-02-10T19:43:45 Z luciocf Hotter Colder (IOI10_hottercolder) C++14
50 / 100
773 ms 12288 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

int HC(int n)
{
	if (n == 1) return 1;

	int ini = 1, fim = n;

	int it = 0;

	while (ini <= fim)
	{
		if (ini == fim) return ini;
		if (fim-ini == 1)
		{
			Guess(ini);
			int g = Guess(fim);

			return (g == -1 ? ini : fim);
		}

		int delta = (fim-ini+1)/3;

		int mid1 = ini + delta - 1;
		int mid2 = fim - delta + 1;

		Guess(mid1);
		int g = Guess(mid2);
		it += 2;

		if (g == 0) return (mid1+mid2)/2;
		else if (g == 1) ini = (mid1+mid2)/2 + 1;
		else fim = (mid1+mid2)/2;
	}

}

Compilation message

hottercolder.cpp: In function 'int HC(int)':
hottercolder.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1272 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 773 ms 12288 KB Output isn't correct - alpha = 0.000000000000