Submission #783595

#TimeUsernameProblemLanguageResultExecution timeMemory
783595HanksburgerA Difficult(y) Choice (BOI21_books)C++17
0 / 100
1 ms292 KiB
#include "books.h" #include <bits/stdc++.h> using namespace std; vector<int> ans; void solve(int n, int k, long long a, int s) { long long x[11], y[11], l=1, r=n+1; while (l<r) { int m=(l+r)/2; if (skim(m)>=a) r=m; else l=m+1; } for (int i=1; i<=k; i++) x[i]=min((long long)1e18, x[i-1]+skim(i)); if (l>=k && l<=n) { if (x[k-1]+skim(l)<=a*2) { for (int i=1; i<k; i++) ans.push_back(i); ans.push_back(l); answer(ans); return; } } if (l>k) { for (int i=1; i<=k; i++) y[i]=min((long long)1e18, y[i-1]+skim(l-i)); for (int i=0; i<=k; i++) { if (x[k-i]+y[i]>=a && x[k-i]+y[i]<=a*2) { for (int j=1; j<=k-i; j++) ans.push_back(j); for (int j=l-i; j<l; j++) ans.push_back(j); answer(ans); return; } } } impossible(); }
#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...