Submission #753238

#TimeUsernameProblemLanguageResultExecution timeMemory
753238boyliguanhanThe Big Prize (IOI17_prize)C++17
100 / 100
75 ms10808 KiB
#include "prize.h" #include<bits/stdc++.h> using namespace std; set<int> st[200100]; int l[200100]; int calc(int x, int y) { if(x>y)return-1; int z = x+y>>1; vector<int>v=ask(z); int k=(l[z]=v[0])+v[1], t=-1; if(!k) return z; auto a = st[k].insert(z).first; if(a==st[k].begin()||l[*prev(a)]<l[z]) t = max(t, calc(x, z-1)); if(a==(--st[k].end())||l[*next(a)]>l[z]) t = max(t, calc(z+1, y)); return t; } int find_best(int n) { return calc(0,n-1); }

Compilation message (stderr)

prize.cpp: In function 'int calc(int, int)':
prize.cpp:8:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    8 |     int z = x+y>>1;
      |             ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...