제출 #119865

#제출 시각아이디문제언어결과실행 시간메모리
119865TuGSGeReL커다란 상품 (IOI17_prize)C++14
20 / 100
33 ms512 KiB
#include "prize.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define mp make_pair #define pub push_back #define pob pop_back() #define ss second #define ff first #define mt make_tuple #define pof pop_front() #define fbo find_by_order #define ook order_of_key #define lb lower_bound #define ub upper_bound typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; using pll = pair <ll, ll>; using pii = pair <int, int>; int a[200001], ans = -1; void solve(int l, int r) { if ( ans != -1 || l > r ) return; vector <int> resl = ask(l); vector <int> resr = ask(r); if ( resl[0] + resl[1] == 0 ) { ans = l; return; } if ( resr[0] + resr[1] == 0 ) { ans = r; return; } if (resl[0] + resl[1] < resr[0] + resr[1]) { solve(l + 1, r); return; } if (resl[0] + resl[1] > resr[0] + resr[1]) { solve(l, r - 1); return; } if ( resl[0] == resr[0] && resl[1] == resr[1] ) return; int mid = (l + r) / 2; solve(l, mid); solve(mid, r); } int find_best(int n) { solve(0, n - 1); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...