제출 #1079195

#제출 시각아이디문제언어결과실행 시간메모리
1079195speedcodeThe Big Prize (IOI17_prize)C++17
20 / 100
66 ms344 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; int find_best(int n) { //binary search the first element each time map<int, int> hi; hi[n-1] = 0; int last = 0; auto a = ask(0); if (a[0] + a[1] == 0) return 0; for (auto k: hi) { if (k.first > a[0] + a[1])hi[k.first]++; } while (true) { int i1 = last; int i2 = n - 1; while (i1 != i2) { int middle = (i1 + i2) / 2; auto a = ask(middle); if (a[0] + a[1] == 0) return middle; if (a[0] - hi[a[0] + a[1]] == 0) { i1 = middle+1; } else { i2 = middle - 1; } } auto a = ask(i1); if (a[0] + a[1] == 0) return i1; last = i1; for (auto k: hi) { if (k.first > a[0] + a[1])hi[k.first]++; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...