제출 #531383

#제출 시각아이디문제언어결과실행 시간메모리
531383physics07A Difficult(y) Choice (BOI21_books)C++17
0 / 100
3 ms200 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; typedef long long ll; ll adj[100001]; vector<int> ans; void solve(int n, int k, ll a, int s) { for(int i=1; i<=n; i++) adj[i]=skim(i); int p=lower_bound(adj+1, adj+n+1, a)-adj; p--; if(p<=k-2) impossible(); if(p==k-1) { ll sum=0; for(int i=1; i<=p+1; i++) { sum+=adj[i]; ans.push_back(i); } if(sum>=a && sum<=a*2) answer(ans); else impossible(); } ll sum=0; for(int i=1; i<=k; i++) sum+=adj[k]; int idx=k+1; while(idx<=p+1 && sum<a) { sum-=adj[idx-k]; sum+=adj[idx]; idx++; } if(sum<a || sum>2*a) impossible(); for(int i=idx-k; i<idx; i++) ans.push_back(i); answer(ans); }
#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...