# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328288 | arnold518 | The Big Prize (IOI17_prize) | C++14 | 86 ms | 2028 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 long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2e5;
int N;
pii M[MAXN+10];
pii query(int x)
{
if(M[x]!=pii(-1, -1)) return M[x];
vector<int> res=ask(x-1);
return M[x]=pii(res[0], res[1]);
}
int find_best(int _N)
{
N=_N;
for(int i=1; i<=N; i++) M[i]=pii(-1, -1);
for(int i=1; i<=N;)
{
pii p=query(i);
if(p.first==0 && p.second==0) return i-1;
int lo=i, hi=N+1;
while(lo+1<hi)
{
int mid=lo+hi>>1;
if(query(mid)==p) lo=mid;
else hi=mid;
}
i=hi;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |