# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
427592 | MOUF_MAHMALAT | The Big Prize (IOI17_prize) | C++14 | 125 ms | 5496 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;
typedef int ll;
ll id,l,r,m,x;
vector<ll>v[200009];
int find_best(int n)
{
for(ll i=0;i<min(n,500);i++)
{
v[i]=ask(i);
if(v[i][0]+v[i][1]==0)
return i;
if(v[i][0]+v[i][1]>v[id][0]+v[id][1])
id=i;
}
x=id;
while(id<n)
{
if(v[id].empty())
v[id]=ask(id);
if(v[id][0]+v[id][1]==0)
return id;
if(v[x][0]+v[x][1]!=v[id][0]+v[id][1])
{
id++;
continue;
}
l=id,r=n;
while(r-l>1)
{
m=(l+r)/2;
if(v[m].empty())
v[m]=ask(m);
if(v[m][0]+v[m][1]==0)
return m;
if(v[m]==v[id])
l=m;
else
r=m;
}
id=l+1;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |