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 <bits/stdc++.h>
#include "books.h"
#define eb emplace_back
using namespace std;
typedef long long ll;
void ans(int st, int k){
vector<int> v(k);
for(int i = 0; i < k; i++) v[i] = st + i;
answer(v);
}
void solve(int n, int k, ll A, int S){
assert(n == S);
vector<ll> x(n + 1);
for(int i = 1; i <= n; i++){
x[i] = skim(i);
}
ll sum = 0;
for(int i = 1; i <= k; i++) sum += x[i];
if(sum > 2 * A) impossible();
if(sum >= A) ans(1, k);
int i;
for(i = k + 1; i <= n && x[i] < A; i++){
sum -= x[i - k];
sum += x[i];
if(sum >= A){
assert(sum <= 2 * A);
ans(i - k + 1, k);
}
}
if(i == n + 1) impossible();
sum = x[i];
for(int j = 1; j < k; j++) sum += x[j];
if(sum <= 2 * A){
vector<int> v;
for(int j = 1; j < k; j++) v.eb(j);
v.eb(i);
answer(v);
}
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... |