Submission #268692

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2686922020-08-16 18:35:27PlurmThe Big Prize (IOI17_prize)C++11
96.73 / 100
75 ms5368 KiB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> memoiz[200005];
int key = -1;
vector<int> customAsk(int x){
// Memoized version of ask
if(memoiz[x].empty()) memoiz[x] = ask(x);
key = max(key, memoiz[x][0] + memoiz[x][1]);
return memoiz[x];
}
int solve(int l, int r, int offsL = 0, int offsR = 0){
if(l > r) return -1;
if(l == r) return customAsk(l)[0] + customAsk(l)[1] == 0 ? l : -1;
int m = (l+r)/2;
vector<int> res = customAsk(m);
while(res[0] + res[1] != key){
if(res[0] + res[1] == 0) return m;
if(m == r) break;
m++;
res = customAsk(m);
}
if(m == r){
m = (l+r)/2;
while(res[0] + res[1] != key){
if(res[0] + res[1] == 0) return m;
if(m == l) return -1;
m--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...