Submission #1134937

#TimeUsernameProblemLanguageResultExecution timeMemory
1134937pokmui9909The Big Prize (IOI17_prize)C++17
0 / 100
5 ms9928 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; using ll = long long; set<ll> S[200005]; ll L[200005]; ll dnc(ll l, ll r){ if(l > r) return -1; ll m = (l + r) / 2; auto t = ask(m); ll v = t[0] + t[1]; if(v == 0) return m; S[v].insert(m); L[m] = t[0]; auto it = S[v].lower_bound(m); if(it == S[v].begin() || L[*prev(it)] != L[m]){ ll f = dnc(l, m - 1); if(f != -1) return f; } if(it != prev(S[v].end()) || L[*next(it)] != L[m]){ ll f = dnc(m + 1, r); if(f != -1) return f; } return -1; } int find_best(int N){ return dnc(0, N - 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...