This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///~~~LOTA~~~///
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define MAXN 200000
vector<int> a[MAXN];
vector<int> get(int x){
if(a[x].empty())
a[x]=ask(x);
return a[x];
}
int find_best(int n){
int m,o;
srand(time(0));
vector<int> a;
for(int i=m=0;i<500;i++){
a=get(rand()%n);
m=max(m,a[0]+a[1]);
}
o=0;
while(o<n){
a=get(o);
if(!a[0] && !a[1])
return o;
if(a[0]+a[1]==m){
for(int i=131072;i>0;i/=2){
if(o+i<n && get(o+i)==a)
o+=i;
}
}
o++;
}
return o;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |