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;
void solve(int N, int K, long long A, int S)
{
long long mas[N+5],sum=0;
for(int i=1;i<=K;i++)
{
mas[i]=skim(i);
sum+=mas[i];
}
if(sum>2*A)
{
impossible();
return;
}
int l=K,r=N+1;
while(l+1<r)
{
int mid=(l+r)/2;
if(sum-mas[K]+skim(mid)<=2*A)
{
l=mid;
}
else
{
r=mid;
}
}
int o2=l;
for(int i=o2,uk=K-1;uk>=0;i--,uk--)
{
sum-=mas[uk+1];
sum+=skim(i);
if(sum>=A)
{
vector < int > rt;
for(int j=1;j<=uk;j++)
{
rt.push_back(j);
}
for(int j=i;j<=o2;j++)
{
rt.push_back(j);
}
answer(rt);
return;
}
}
impossible();
return;
}
# | 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... |