Submission #718158

#TimeUsernameProblemLanguageResultExecution timeMemory
718158Jarif_RahmanThe Big Prize (IOI17_prize)C++17
90 / 100
85 ms5320 KiB
#include "prize.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; vector<int> asked[200000]; vector<int> Ask(int i){ if(asked[i].empty()) asked[i] = ask(i); return asked[i]; } int find_best(int n){ int p = 0; int mx = 0; for(int i = 0; i < min(n, 480); i++){ auto v = Ask(i); mx = max(mx, v[0]+v[1]); } while(1){ auto cur = Ask(p); if(cur[0]+cur[1] == 0) return p; if(cur[0]+cur[1] != mx){ p++; continue; } int a = p+1, b = n-1; while(a < b){ int md = (a+b)/2; auto v = Ask(md); if(v[0]+v[1] != cur[0]+cur[1]) b = md; else if(v[0] != cur[0]) b = md-1; else a = md+1; } p = a; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...