제출 #828057

#제출 시각아이디문제언어결과실행 시간메모리
828057tranxuanbach커다란 상품 (IOI17_prize)C++17
20 / 100
3 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 = 0, hi = n - 1; 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...