# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316184 | nikatamliani | The Big Prize (IOI17_prize) | C++14 | 87 ms | 372 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 <bits/stdc++.h>
using namespace std;
#include "prize.h"
int find_best(int n) {
int next = -1, at_most = min(500, n);
vector < int > bad(2);
for(int i = 0; i <= at_most; ++i) {
vector < int > cur = ask(i);
if(bad[0] + bad[1] < cur[0] + cur[1]) bad = cur;
}
for(int i = 0; i < n; i = next + 1) {
int l = i, r = n - 1; next = -1;
vector < int > t = ask(i);
if(t[0] + t[1] != bad[0] + bad[1]) {
next = i;
if(t[0] == 0 && t[1] == 0) return i;
continue;
}
while(r >= l) {
int m = l + r >> 1;
vector < int > x = ask(m);
if(x == t) {
next = m;
l = m + 1;
} else {
r = m - 1;
}
}
assert(next >= i);
}
//this is bad
for(int i = 0; i < n; ++i) {
vector < int > p = ask(i);
if(!p[0] && !p[1]) return i;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |