Submission #906276

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9062762024-01-13 22:35:52Ahmed57A Difficult(y) Choice (BOI21_books)C++17
100 / 100
2 ms1404 KiB
#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);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...