Submission #1067366

#TimeUsernameProblemLanguageResultExecution timeMemory
1067366Ignut커다란 상품 (IOI17_prize)C++17
20 / 100
51 ms428 KiB
// Ignut #include <bits/stdc++.h> using namespace std; using ll = long long; vector<int> ask(int i); int find_best(int n) { map<int, int> mp; int L = -1; while (L < n - 1) { int lo = L + 1, hi = n - 1; while (lo < hi) { int mid = lo + (hi - lo) / 2; vector<int> vec = ask(mid); if (vec[0] + vec[1] == 0) return mid; int lvl = vec[0] + vec[1]; int comp = 0; for (auto [a, b] : mp) if (a < lvl) comp += b; if (vec[0] > comp) hi = mid - 1; else { lo = mid + 1; mp[lvl] ++; } } vector<int> vec = ask(lo); if (vec[0] + vec[1] == 0) return lo; int lvl = vec[0] + vec[1]; mp[lvl] ++; L = lo; } } /* 8 3 2 3 1 3 3 2 3 */

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:11:16: warning: control reaches end of non-void function [-Wreturn-type]
   11 |  map<int, int> mp;
      |                ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...