| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 434784 | dutch | The Big Prize (IOI17_prize) | C++17 | 68 ms | 320 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"
const int LIM = 480;
int ans, val;
void search(int l, int r, int lx, int rx){
if(l > r || ans >= 0 || lx + rx == val) return;
int m1 = (l + r) / 2, m2 = m1 + 1, x, y, cnt = -1;
vector<int> q = {0, 0};
while(q[0] + q[1] < val){
if((y = m1-l > r-m2)) x = m1--;
else x = m2++;
q = ask(x);
if(q[0] + q[1] == 0) return void(ans = x);
++cnt;
}
q[!y] += cnt;
search(l, m1, lx, q[1]);
search(m2, r, q[0], rx);
}
int find_best(int n){
ans = val = -1;
for(int i=0; i<min(n, LIM); ++i){
vector<int> q = ask(i);
val = max(val, q[0] + q[1]);
}
search(0, n-1, 0, 0);
return ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
