제출 #828056

#제출 시각아이디문제언어결과실행 시간메모리
828056tranxuanbach커다란 상품 (IOI17_prize)C++17
0 / 100
4 ms5072 KiB
#include "prize.h" #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n; vector <int> query_answer[N]; int cnt_left[N], cnt_right[N]; int type[N]; void query(int x){ if (not query_answer[x].empty()){ return; } query_answer[x] = ask(x); cnt_left[x] = query_answer[x].front(); cnt_right[x] = query_answer[x].back(); type[x] = accumulate(query_answer[x].begin(), query_answer[x].end(), 0); } int find_best(int _n){ n = _n; int lo = 1, hi = n; while (lo < hi){ int mid = (lo + hi) >> 1; query(mid); if (type[mid] == 0){ return mid; } if (cnt_left[mid]){ hi = mid - 1; } else{ lo = mid + 1; } } return lo; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...