Submission #566413

#TimeUsernameProblemLanguageResultExecution timeMemory
566413TemmieThe Big Prize (IOI17_prize)C++17
0 / 100
1 ms208 KiB
//#include "public_a/cpp/prize.h"
#include "prize.h"

#include <bits/stdc++.h>

int find_best(int n) {
	if (!ask(0)[1]) {
		return 0;
	}
	int ans = 0;
	for (int b = 21; ~b; b--) {
		if (ans | (1 << b) >= n) {
			continue;
		}
		if (!ask(ans | (1 << b))[0]) {
			ans |= 1 << b;
		}
	}
	return ans + 1;
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:12:22: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   12 |   if (ans | (1 << b) >= n) {
      |             ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...