제출 #941830

#제출 시각아이디문제언어결과실행 시간메모리
941830LCJLYA Difficult(y) Choice (BOI21_books)C++14
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; //code //skim() impossible() answer({}); void solve(int n, int k, long long a, int s) { int hold=skim(n); vector<int>v; if(hold>=a){ int counter=0; for(int x=1;x<k;x++){ v.push_back(x); counter+=skim(x); } int l=k; int r=n; int mid; while(l<=r){ mid=(l+r)/2; int take=skim(mid); if(take+counter>=a&&take+counter<=2*a){ v.push_back(mid); answer(v); return; } else if(take+counter<a){ l=mid+1; } else r=mid-1; } impossible(); } else{ int counter=0; vector<pair<int,int>>cur; for(int x=1;x<=k;x++){ cur.push_back({skim(x),x}); counter+=cur.back().first; } int ptr=n; if(n==k&&counter<a){ impossible(); return; } while(counter<a&&!cur.empty()){ counter+=skim(ptr); ptr--; counter-=cur.back().first; cur.pop_back(); v.push_back(ptr); } if(counter>=a){ for(auto it:cur) v.push_back(it.second); answer(v); return; } impossible(); } } //code
#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...