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>
using namespace std;
typedef long long ll;
const string ny[2] = {"No", "Yes"};
#include"books.h"
void solve(int n, int k, long long a, int S) {
ll cad[n+4]={ };
ll v[k+2]={ },ac=0;
v[k+1]=n+1;
for(int i=1; i<=n; i++)
{
cad[i]=skim(i);
if(i<=k)
{
v[i]=i;
ac+=cad[i];
}
}
for(int i=k; i>0; i--)
{
while(v[i]+1<v[i+1]&& ac<a&&ac-cad[v[i]]+cad[v[i]+1]<=2*a)
{
ac-=cad[v[i]];
v[i]++;
ac+=cad[v[i]];
}
}
if(ac<a||ac>2*a)
{
impossible();
return;
}
vector<int> ans;
for(int i=1; i<=k; i++)
ans.push_back(v[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... |