# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
820900 | ZHIRDILBILDIZ | The Big Prize (IOI17_prize) | C++14 | 3029 ms | 4996 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<bits/stdc++.h>
#include "prize.h"
using namespace std ;
const int N = 2e5 ;
int cnt ;
vector<int> all[N] ;
//vector<int> ask(int ind)
//{
// cnt++ ;
// vector<int> v(2) ;
// cout << "? " << ind << '\n' ;
// cin >> v[0] >> v[1] ;
// return v ;
//}
int find_best(int n)
{
int ind = 0, gl = 0, gr = n ;
while(ind < gr)
{
ind = gl ;
vector<int> abu = all[ind] ;
if(!abu.size())
{
cnt++ ;
abu = ask(ind) ;
all[ind] = abu ;
}
if(cnt == 10000)
{
while(true)
{
}
}
if(!abu[0] && !abu[1])
return ind ;
int l = ind, r = gr ;
while(l + 1 < r)
{
int mid = (l + r) / 2 ;
vector<int> now = all[mid] ;
if(!now.size())
{
cnt++ ;
now = ask(mid) ;
all[mid] = now ;
}
if(cnt == 10000)
{
while(true)
{
}
}
if(!now[0] && !now[1])
return mid ;
else
{
if(!now[0])
{
gl = mid + 1 ;
break ;
}
if(!now[1])
{
gr = mid ;
break ;
}
if(now[0] == abu[0] && now[1] == abu[1])
l = mid ;
else
r = mid ;
}
}
ind = l + 1 ;
}
}
//signed main()
//{
// int n ;
// cin >> n ;
// cout<<find_best(n) ;
// return 0 ;
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |