# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
642073 | piOOE | The Big Prize (IOI17_prize) | C++17 | 97 ms | 2632 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>
#include "prize.h"
using namespace std;
using ll = long long;
int find_best(int n) {
int i = 0;
int logn = __lg(n) + 2;
map<int, vector<int>> mp;
int Q = 0;
auto my_ask = [&](int i) {
if (mp.count(i)) {
return mp[i];
} else {
++Q;
if (Q > 10000) {
assert(false);
}
mp[i] = ask(i);
return mp[i];
}
};
for (; i < n;) {
auto a = my_ask(i);
if (a[0] == 0 && a[1] == 0) {
return i;
} else {
int j;
if (a[0] + a[1] < 100) j = 10;
else if (a[0] + a[1] < 50) j = 7;
else j = 20;
for (; j > -1; --j) {
if (i + (1 << j) < n && my_ask(i + (1 << j)) == a) {
i += 1 << j;
}
}
++i;
}
}
assert(false);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |