Submission #55047

# Submission time Handle Problem Language Result Execution time Memory
55047 2018-07-05T22:46:31 Z adamczh1 The Big Prize (IOI17_prize) C++17
20 / 100
100 ms 572 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;

int find_best(int n) {
	int lo = 0, hi = n - 1;
	int last = INT_MAX;
	while (1) {
		int mid = (lo + hi) / 2;
		vector<int> tmp = ask(mid);
		if (tmp[0] + tmp[1] == 0) {
			return mid;
		}
		if (tmp[0] + tmp[1] < last) {
			last = tmp[0] + tmp[1];
			lo = 0, hi = n - 1;
		}
		if (tmp[0] > tmp[1]) {
			hi = mid - 1;
		} else {
			lo = mid + 1;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 444 KB Output is correct
3 Correct 2 ms 444 KB Output is correct
4 Correct 2 ms 444 KB Output is correct
5 Correct 2 ms 496 KB Output is correct
6 Correct 3 ms 496 KB Output is correct
7 Correct 2 ms 516 KB Output is correct
8 Correct 2 ms 556 KB Output is correct
9 Correct 2 ms 556 KB Output is correct
10 Correct 2 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 556 KB Output is correct
2 Correct 3 ms 556 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 556 KB Output is correct
5 Correct 2 ms 556 KB Output is correct
6 Correct 3 ms 556 KB Output is correct
7 Correct 3 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 2 ms 572 KB Output is correct
10 Correct 2 ms 572 KB Output is correct
11 Incorrect 100 ms 572 KB Incorrect
12 Halted 0 ms 0 KB -