제출 #783638

#제출 시각아이디문제언어결과실행 시간메모리
783638HanksburgerA Difficult(y) Choice (BOI21_books)C++17
100 / 100
1 ms300 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]=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]=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...