제출 #553727

#제출 시각아이디문제언어결과실행 시간메모리
553727timreizin커다란 상품 (IOI17_prize)C++17
20 / 100
3031 ms5156 KiB
#include "prize.h" #include <iostream> using namespace std; int find_best(int n) { vector<vector<int>> mem(n); int prev = -1; for (int i = 1;; ++i) { int l = 0, r = n; //first with left = i while (l < r) { int m = (l + r) >> 1; if (mem[m].empty()) mem[m] = ask(m); if (mem[m][0] + mem[m][1] == 0) return m; if (mem[m][0] < i) l = m + 1; else r = m; } prev = l - 1; if (mem[prev].empty()) mem[prev] = ask(prev); if (mem[prev][0] + mem[prev][1] == 0) return prev; } } //1 2 5 26 677 - mins //1 4 21 446 200000 - maxs
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...