Submission #390456

#TimeUsernameProblemLanguageResultExecution timeMemory
390456KeshiThe Big Prize (IOI17_prize)C++17
20 / 100
118 ms1096 KiB
//In the name of God #include <bits/stdc++.h> #include "prize.h" using namespace std; typedef int ll; typedef pair<ll, ll> pll; const ll maxn = 2e5 + 100; const ll mod = 1e9 + 7; const ll inf = 1e9; #define pb push_back #define Mp make_pair #define F first #define S second #define Sz(x) ll((x).size()) #define all(x) (x).begin(), (x).end() ll p[maxn]; int find_best(int n){ srand(time(NULL)); for(ll i = 0; i < n; i++){ p[i] = i; } random_shuffle(p, p + n); ll x = 0; for(ll i = 0; i < min(10, n); i++){ auto f = ask(p[i]); x = max(x, f[0] + f[1]); } ll ptr = 0; while(ptr < n){ auto f = ask(ptr); if(f[0] + f[1] == 0) return ptr; if(f[0] + f[1] != x){ ptr++; continue; } ll l = ptr, r = n; while(r - l > 1){ ll mid = (l + r) >> 1; auto f2 = ask(mid); if(f2[0] == f[0] && f2[1] == f[1]) l = mid; else r = mid; } ptr = r; } return -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...