Submission #585334

#TimeUsernameProblemLanguageResultExecution timeMemory
585334VanillaThe Big Prize (IOI17_prize)C++17
20 / 100
23 ms1972 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; int nr[] = {1, 2, 5, 26, 677}; int vmx = 0, vpos = 0; const int maxn = 2e5 + 2; int pref [maxn]; int mark [maxn]; void upd (int x) { mark[x] = 1; for (int i = x; i < maxn; i++){ pref[i]++; } } int find_best(int n) { for (int i = 0; i < min(500, n); i++){ vector <int> k = ask(i); if (k[0] + k[1] > vmx) { vmx = k[0] + k[1]; vpos = i; } } for (int i = 0; i < vmx; i++){ int l = 0, r = n - 1; while (l <= r) { int mid = (l + r) / 2; // cout << i << " " << l << " " << r << "\n"; vector <int> k = ask(mid); if (k[0] + k[1] == 0) return mid; if (k[0] + k[1] != vmx && !mark[mid]) { // cout << mid << "\n"; upd(mid); break; } if (k[0] - pref[mid]) { r = mid - 1; } else { l = mid + 1; } } } assert(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...