# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1075791 | mdn2002 | The Big Prize (IOI17_prize) | C++14 | 65 ms | 344 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<bits/stdc++.h>
using namespace std;
int find_best(int n) {
int mx = 0, lim = 500;
for (int i = 0; i < min(n, lim); i ++) {
vector<int> a = ask(i);
mx = max(mx, a[0] + a[1]);
if (a[0] + a[1] == 0) return i;
}
for (int i = 0; i < n; i ++) {
vector<int> a = ask(i);
int logg = log2(a[1] + 1) + 2;
if (a[0] + a[1] == mx) {
for (int j = (1 << logg); j >= 1; j /= 2) {
if (i + j >= n) continue;
vector<int> b = ask(i + j);
if (a[1] == b[1]) i += j;
}
}
else if (a[0] + a[1] == 0) return i;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |