# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549847 | Pherokung | A Difficult(y) Choice (BOI21_books) | C++14 | 1 ms | 208 KiB |
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 be = 1,ed = n;
vector<int> V;
while(be <= ed){
ll mid = (be+ed)/2,val;
if(skim(mid) > a) ed = mid-1;
else be = mid+1;
if(ed < k){
impossible();
return;
}
}
V.push_back(0);
for(int i=1;i<=k;i++) V.push_back(skim(i));
for(int i=max((ll)k+1,ed-k+1);i<=ed;i++) V.push_back(skim(i));
ll qs[25];
qs[0] = 0;
for(int i=1;i<V.size();i++) qs[i] = qs[i-1] + V[i];
vector<int> ANS;
for(int i=0;i<V.size();i++){
ll val = qs[i] + (qs[V.size()-1] - qs[V.size()-(k-i+1)]);
if(val >= a && val <= 2*a){
for(int j=1;j<=i;j++) ANS.push_back(j);
for(int j=(k-i)-1;j>=0;j--) ANS.push_back(ed-j);
answer(ANS);
return;
}
}
impossible();
}
Compilation message (stderr)
# | 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... |