Submission #511216

# Submission time Handle Problem Language Result Execution time Memory
511216 2022-01-15T12:40:45 Z rajatshenoi Colors (BOI20_colors) C++14
0 / 100
300 ms 200 KB
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
	int N;
	cin >> N;

	vector<int> vec;

	// for (int i = 1; i <= N; i++) vec.push_back(i);

	int left = 1, right = N;
	int prev = N;
	int i = 0;
	while (true)
	{
		int mid = (left + right) / 2;

		if (left == mid)
		{
			cout << "= " << left << endl;
			break;
		}

		int realise;
		cout << "? " << mid << endl;
		cin >> realise;

		if (i == 0)
		{
			i++;
			continue;
		}
		else
		{
			if (realise == 1)
			{
				right = abs(prev - mid);
			}
			else if (realise == 0)
			{
				left = mid - 1;
			}
			prev = mid;
		}
	}

	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2309 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2309 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2309 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2309 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2309 ms 200 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -