#include <bits/stdc++.h>
#define ll long long
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fr first
#define se second
using namespace std;
vector<int> ask(int i);
map<int,vector<int>>m;
vector<int>as(int i)
{
auto it=m.find(i);
if(it!=m.end())
return{-1,-1};
m[i]=ask(i);
return m[i];
}
int find_best(int n) {
ll i, x;
vector<int>a;
for(i=0; i<10000; i++)
{
x=rand()%n;
a=as(x);
if(a[0]==-1)
{
i--;
continue;
}
if(a[0]==0&&a[1]==0)
return x;
}
return rand()%n;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |