# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
758452 | Andrey | The Big Prize (IOI17_prize) | C++14 | 94 ms | 336 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 y = 0,l,r,m,x,big = 0,z;
for(int i = 0; i*i < n; i++) {
vector<int> a = ask(i);
if(a[0] == 0 && a[1] == 0) {
return i;
}
if(a[0]+a[1] > big) {
big = a[0]+a[1];
y = i+1;
}
}
while(y < n) {
l = y;
r = n-1;
vector<int> a = ask(y);
x = a[0];
z = a[1];
while(l < r) {
m = (l+r+1)/2;
a = ask(m);
if(a[0] == x && a[1] == z) {
l = m;
}
else {
r = m-1;
}
}
a = ask(l+1);
if(a[0] == 0 && a[1] == 0) {
return l+1;
}
y = l+2;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |