Submission #529607

#TimeUsernameProblemLanguageResultExecution timeMemory
529607mjhmjh1104A Difficult(y) Choice (BOI21_books)C++17
10 / 100
1 ms276 KiB
#include <map> #include "books.h" using namespace std; map<int, long long> m; long long get(int x, int K) { long long ret = 0; for (int i = 0; i < K; i++) { if (m.find(x + i + 1) == m.end()) m[x + i + 1] = skim(x + i + 1); ret += m[x + i + 1]; } return ret; } void solve(int N, int K, long long A, int S) { int l = 0, r = N - K; while (l < r) { int m = (l + r) / 2; long long t = get(m, 1); if (t < A / K) l = m + 1; else r = m; } while (l >= 0) { long long t = get(l, K); if (t >= A && t <= 2 * A) { vector<int> v; for (int i = 0; i < K; i++) v.push_back(l + i + 1); answer(v); return; } else if (t < A) { impossible(); return; } else l--; } impossible(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...