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>
using namespace std;
vector<int> ans;
void solve(int n, int k, long long a, int s)
{
long long x[11], y[11], l=1, r=n+1;
while (l<r)
{
int m=(l+r)/2;
if (skim(m)>=a)
r=m;
else
l=m+1;
}
for (int i=1; i<=k; i++)
x[i]=x[i-1]+skim(i);
if (l<=n)
{
if (x[k-1]+skim(l)<=a*2)
{
for (int i=1; i<k; i++)
ans.push_back(i);
ans.push_back(l);
answer(ans);
return;
}
}
if (l>k)
{
for (int i=1; i<=k; i++)
y[i]=y[i-1]+skim(l-i);
for (int i=0; i<=k; i++)
{
if (x[k-i]+y[i]>=a && x[k-i]+y[i]<=a*2)
{
for (int j=1; j<=k-i; j++)
ans.push_back(j);
for (int j=l-i; j<l; j++)
ans.push_back(j);
answer(ans);
return;
}
}
}
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... |