제출 #969712

#제출 시각아이디문제언어결과실행 시간메모리
969712maxFedorchukA Difficult(y) Choice (BOI21_books)C++17
100 / 100
1 ms1368 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int N, int K, long long A, int S) { long long mas[N+5],sum=0; for(int i=1;i<=K;i++) { mas[i]=skim(i); sum+=mas[i]; } if(sum>2*A) { impossible(); return; } int l=K,r=N+1; while(l+1<r) { int mid=(l+r)/2; if(sum-mas[K]+skim(mid)<=2*A) { l=mid; } else { r=mid; } } int o2=l; for(int i=o2,uk=K-1;uk>=0;i--,uk--) { sum-=mas[uk+1]; sum+=skim(i); if(sum>=A) { vector < int > rt; for(int j=1;j<=uk;j++) { rt.push_back(j); } for(int j=i;j<=o2;j++) { rt.push_back(j); } answer(rt); return; } } impossible(); return; }
#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...