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
#define pii pair<int, int>
using namespace std;
void solve(int N, int K, long long A, int S) {
vector<ll> v(N);
for(int i = 0; i < N; i++){
v[i] = skim(i + 1);
}
for(int i = 0; i < N - K + 1; i++){
ll a = 0;
vector<int> ans;
for(int j = i; j < i + K; j++){
a += v[j];
ans.push_back(j + 1);
}
if(A <= a && a <= 2 * A){
answer(ans);
return;
}
}
vector<int> ans;
auto itr = lower_bound(v.begin(), v.end(), A);
if(itr == v.end()){
impossible();
return;
}
ll a = *itr;
ans.push_back((itr - v.begin()) + 1);
for(int i = 0; i < K - 1; ++i){
a += v[i];
ans.push_back(i + 1);
}
if(A <= a && a <= 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... |