Submission #430456

# Submission time Handle Problem Language Result Execution time Memory
430456 2021-06-16T14:01:11 Z Popax21 The Big Prize (IOI17_prize) C++17
20 / 100
1 ms 404 KB
#include <assert.h>
#include "prize.h"

std::pair<int, int> query(int p) {
	std::vector<int> r = ask(p);
	return std::make_pair(r[0], r[1]);
}

int binsearch(int l, int r) {
	assert(l < r);
	if(l == r-1) return l;

	int m = l + (r-l) / 2;
	auto[lc, rc] = query(m);
	if(lc == 0 && rc == 0) return m;

	if(lc != 0) return binsearch(l, m);
	else if(rc != 0) return binsearch(m+1, r);
	else assert(false);
}

int find_best(int n) {
	return binsearch(0, n);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 284 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 280 KB Output is correct
6 Correct 1 ms 280 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 284 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 284 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 276 KB Output is correct
9 Correct 1 ms 288 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Runtime error 1 ms 404 KB Execution killed with signal 6
12 Halted 0 ms 0 KB -