This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "books.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 2e5 + 42;
ll val[MAXN];
ll get(int i) {
if(val[i] == 0)
val[i] = skim(i);
return val[i];
}
void solve(int N, int K, ll A, int S) {
for(int i = 1; i <= N; i++)
get(i);
int last = N+1;
vector<int> ans;
ll sum = 0;
for(int i = 1; i <= K; i++)
sum += val[i];
for(int i = K; i > 0; i--) {
for(int j = i; j < last; j++) {
if(j == last-1 || sum + val[j+1] - val[i] > 2*A) {
sum += val[j] - val[i];
ans.push_back(j);
last = j;
}
}
}
if(A <= sum && sum <= 2*A)
answer(ans);
else
impossible();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |