# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
407007 | ja_kingy | The Big Prize (IOI17_prize) | C++14 | 74 ms | 6060 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prize.h"
#include <iostream>
using namespace std;
vector<int> cache[200000];
int ans, cnt, done[200000], n;
vector<int> askc(int x) {
if (!done[x]) {
done[x] = 1;
cache[x] = ask(x);
}
return cache[x];
}
void find(int l, int r, int el, int er) {
if (r < l) return;
if (cnt == el + er) return;
int m = l+r>>1;
int x = m;
vector<int> res;
for (; x <= r; x++) {
res = askc(x);
if (res[0] == 0 && res[1] == 0) ans = x;
if (res[0] + res[1] > cnt) {
cnt = res[0] + res[1];
find(0, n-1, 0, 0);
}
if (res[0] + res[1] == cnt) break;
}
if (l != r) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |