# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
906276 | Ahmed57 | A Difficult(y) Choice (BOI21_books) | C++17 | 2 ms | 1404 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 "books.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int n,int k,long long a,int s){
int l = 1 , r = n , ans = n+1;
while(l<=r){
int mid = (l+r)/2;
if(skim(mid)>a){
ans = mid;
r = mid-1;
}else l = mid+1;
}
long long arr[k+1];
long long las[n+1];
long long all = 0;
for(int i= 1;i<=k;i++){
arr[i] = skim(i);
if(i<k){
all+=arr[i];
}
}
for(int i = min(ans,n);i>=max(1,ans-k);i--){
las[i] = skim(i);
}
if(ans<=n&&all+las[ans]>=a&&all+las[ans]<=2*a&&k-1+(ans>=k)==k){
vector<int> an;
for(int i = 1;i<k;i++)an.push_back(i);
an.push_back(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... |