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"
using namespace std;
typedef long long ll;
ll adj[100001];
vector<int> ans;
void solve(int n, int k, ll a, int s) {
for(int i=1; i<=n; i++) adj[i]=skim(i);
int p=lower_bound(adj+1, adj+n+1, a)-adj;
p--;
if(p<=k-2) impossible();
if(p==k-1) {
ll sum=0;
for(int i=1; i<=p+1; i++) {
sum+=adj[i];
ans.push_back(i);
}
if(sum>=a && sum<=a*2) answer(ans);
else impossible();
}
ll sum=0;
for(int i=1; i<=k; i++) sum+=adj[k];
int idx=k+1;
while(idx<=p && sum<a) {
sum-=adj[idx-k];
sum+=adj[idx];
idx++;
}
if(sum<a || sum>2*a) impossible();
for(int i=idx-k; i<idx; i++) ans.push_back(i);
answer(ans);
}
# | 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... |