Submission #42246

#TimeUsernameProblemLanguageResultExecution timeMemory
42246yusufakeThe Big Prize (IOI17_prize)C++98
100 / 100
24 ms2024 KiB
#include<bits/stdc++.h> using namespace std; #include "prize.h" #define _ int v, int tl, int tr, int l, int r #define tm (tl + tr >> 1) #define sol v+v,tl,tm,l,r #define sag v+v+1,tm+1,tr,l,r #define mp make_pair #define pb push_back #define st first #define nd second typedef long long ll; typedef pair < int , int > pp; const int mod = 1e9 + 7; const int N = 2e5 + 5; int ans=-1; void f(int l, int r, vector < int > x, vector < int > y){ int m = l+r >> 1; if(ans != -1) return; if(x[0] + x[1] == 0) { ans = l; return; } if(y[0] + y[1] == 0) { ans = r; return; } if(l >= r-1) return; if(x[0] + x[1] == y[0] + y[1] && x[1] == y[1]) return; if(x[0] + x[1] < y[0] + y[1]) { f(l+1,r,ask(l+1),y); return; } if(x[0] + x[1] > y[0] + y[1]) { f(l,r-1,x,ask(r-1)); return; } vector < int > a = ask(m); f(l,m,x,a); f(m,r,a,y); } int find_best(int n){ vector < int > x = ask(0); vector < int > y = ask(n-1); f(0,n-1,x,y); return ans; }

Compilation message (stderr)

prize.cpp: In function 'void f(int, int, std::vector<int>, std::vector<int>)':
prize.cpp:23:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int m = l+r >> 1;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...