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"
#define ll long long
using namespace std;
void solve(int n, int k, long long a, int s) {
ll val = skim(k-1);
ll mi = val,mx = val;
for(int i=1;i<k-1;i++) mi += i, mx += (val-i);
if(a < mi) impossible();
ll be = k,ed = n, last = -1;
vector<int> ANS;
for(int i=1;i<=k-1;i++) ANS.push_back(i);
while(be <= ed){
ll mid = (be+ed)/2;
ll diff = skim(mid);
if(diff + mi >= a && diff + mx <= 2*a){
last = mid;
break;
}
else if(diff + mi < a){
be = mid + 1;
}
else if(diff + mx > 2*a){
ed = mid - 1;
}
}
ANS.push_back(last);
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... |