# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1076156 | amin | The Big Prize (IOI17_prize) | C++14 | 77 ms | 6744 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;
vector<int>q;
int a[1000000],b[1000000];
int find_best(int n) {
int cur=0;
q=ask(0);
a[0]=q[0];
b[0]=q[1];
while(cur!=n)
{
// cout<<cur<<endl;
int p=a[cur];
int pp=b[cur];
if(p==0&&pp==0)
return cur;
int l=0;
int r=n-cur;
while(l<r-1)
{
int mid=(l+r)/2;
q=ask(cur+mid);
a[cur+mid]=q[0];
b[cur+mid]=q[1];
if(p==q[0]&&pp==q[1])
{
l=mid;
}else
r=mid;
}
cur=r+cur;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |