Submission #810718

#TimeUsernameProblemLanguageResultExecution timeMemory
810718MyCodeA Difficult(y) Choice (BOI21_books)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int n, int k, long long A, int S) { int l = 1, r = n - k + 1; while (r - l > 1) { int m = (l + r) / 2; if (skim(m + k - 1) >= A) r = m; else l = m; } int ind = -1; if (skim(l + k - 1) >= A) { ind = l; } else if (skim(r + k - 1) >= A) { ind = r; } long long sum = 0; for (int j = ind; j < ind + k; j++) sum += skim(j); if (ind != -1 && sum >= A && sum <= 2 * A) { vector<int> ans; for (int i = ind; i < ind + k; i++) ans.emplace_back(i); answer(ans); } else { 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...