Submission #734280

#TimeUsernameProblemLanguageResultExecution timeMemory
734280TheSahibA Difficult(y) Choice (BOI21_books)C++17
20 / 100
234 ms976 KiB
#include "books.h" #include <bits/stdc++.h> #define ll long long #define pii pair<int, int> using namespace std; void solve(int N, int K, long long A, int S) { vector<ll> v(N); for(int i = 0; i < N; i++){ v[i] = skim(i + 1); } for(int i = 0; i < N - K + 1; i++){ ll a = 0; vector<int> ans; for(int j = i; j < i + K; j++){ a += v[j]; ans.push_back(j + 1); } if(A <= a && a <= 2 * A){ answer(ans); return; } } vector<int> ans; auto itr = lower_bound(v.begin(), v.end(), A); if(itr == v.end()){ impossible(); return; } ll a = *itr; ans.push_back((itr - v.begin()) + 1); for(int i = 0; i < K - 1; ++i){ a += v[i]; ans.push_back(i + 1); } if(A <= a && a <= 2 * A){ answer(ans); } else{ 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...