# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
434945 | dqhungdl | A Difficult(y) Choice (BOI21_books) | C++17 | 6 ms | 200 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"
using namespace std;
void solve(int N, int K, long long A, int S) {
int l=K,r=N,pivot=-1;
while(l<=r) {
int mid=(l+r)/2;
if(skim(mid)*K<=2*A) {
pivot=mid;
l=mid+1;
} else
r=mid-1;
}
if(pivot==-1)
impossible();
vector<pair<int,int>> V;
for(int i=max(1,pivot-9);i<=min(pivot+10,N);i++)
V.push_back({skim(i),i});
for(int mask=0;mask<(1<<V.size());mask++) {
if(__builtin_popcount(mask)!=K)
continue;
int sum=0;
for(int i=0;i<V.size();i++)
if((mask>>i)&1)
sum+=V[i].first;
if(A<=sum&&sum<=2*A) {
vector<int> rs;
for(int i=0;i<V.size();i++)
if((mask>>i)&1)
rs.push_back(V[i].second);
answer(rs);
}
}
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... |