Submission #285170

#TimeUsernameProblemLanguageResultExecution timeMemory
285170mohammadThe Big Prize (IOI17_prize)C++14
0 / 100
1 ms256 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; #define endl "\n" // #define int long long typedef long long ll ; const ll ooo = 1e14 ; const ll oo = 2e9 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; const int N = 10000010 ; int binary(int lo , int hi , vector<int> l , vector<int> r){ if(lo > hi) return -1; int md = (lo + hi) / 2; vector<int> res = ask(md); if(res[0] + res[1] == 0) return md; int ans = -1; int ra = rand() % 2 ; if(ra){ if(res[1] > 0 && res[1] != l[0]) ans = binary(md+1 , hi , l , res); if(ans == -1 && res[0] > 0 && res[0] != r[1]) ans = binary(lo , md - 1 , res , r); }else { if( res[0] > 0 && res != r && res[1] != r[0]) ans = binary(lo , md - 1 , res , r); if(ans == -1 && res[1] > 0 && res != l && res[0] != r[1]) ans = binary(md+1 , hi , l , res); } return ans ; } int find_best(int n) { srand (time(NULL)); vector<int> x(2 , -1); return binary(0 , n - 1 , x , x); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...