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>
#define F first
#define S second
using namespace std;
pair<int,int>p,p1;
vector<int>v,v1;
int ans=0;
void go(int L,int R)
{
if(L>R)return;
if(L==R)
{
v=ask(L);
if(v[0]+v[1]==0)
{
ans=L;
return;
}
}
else
{
v=ask(L);
if(v[0]+v[1]==0)
{
ans=L;
return;
}
v1=ask(R);
if(v1[0]+v1[1]==0)
{
ans=R;
return;
}
if(v[0]==v1[0] || v[1]==v1[1])return;
int mid=(L+R)/2;
go(L+1,mid);
go(mid+1,R-1);
}
}
int find_best(int n) {
go(0,n-1);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |