Submission #333182

#TimeUsernameProblemLanguageResultExecution timeMemory
333182mohamedsobhi777The Big Prize (IOI17_prize)C++14
20 / 100
91 ms492 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n)
{
	for (int i = 0; i < n; ++i)
	{
		int j = i;
		vector<int> v = ask(i);
		if (v[0] == 0 && v[1] == 0)
			return i;
		int lo = i, hi = n - 1;
		while (lo <= hi)
		{
			int mid = (lo + hi) >> 1;
			vector<int> q = ask(mid);
			if (q == v)
				j = mid,
				lo = mid + 1;
			else
				hi = mid - 1;
		}
		i = j;
	}
	assert(0);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...