Submission #244047

#TimeUsernameProblemLanguageResultExecution timeMemory
244047johuthaHotter Colder (IOI10_hottercolder)C++17
78 / 100
846 ms24184 KiB
#include "grader.h"
#include <iostream>

using namespace std;

int HC(int n)
{
	Guess(1);
	int l = 1, r = n;
	int last = 1;
   	while (l < r)
   	{
		int ot = l;
		if (2*last < (l + r)) ot = r;
		int m = (last + ot);
		int rs = Guess(ot);
		// cerr << l << " " << r << " " << ot << " " << m << " " << last << "\n";
		if (rs == 0) return m/2;
		if ((rs == -1) ^ (ot > last))
		{
			l = m/2 + 1;
		}
		else
		{
			r = m/2 - 1 + (m % 2);
		}
		last = ot;
   	}
	return l;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...