제출 #1135377

#제출 시각아이디문제언어결과실행 시간메모리
1135377eradaxA Difficult(y) Choice (BOI21_books)C++20
20 / 100
61 ms1200 KiB
#include "books.h" #include <bits/stdc++.h> // #define DBG #ifdef DBG #include "../../../dbg.h" #else #define dbg(...) #endif using namespace std; using ll = long long; using vi = vector<int>; using vl = vector<ll>; #define rep(i, n) for (int i = 0; i < (n); i++) #define sz(c) ((int)c.size()) #define all(c) c.begin(), c.end() void solve(int N, int K, ll A, int S) { vl vals(N); rep(i, N) { vals[i] = skim(i + 1); S--; } ll sum = 0; int l = 0, r = K; rep(i, K) { sum += vals[i]; } while (r < N) { if (A <= sum && sum <= 2 * A) { break; } if (sum < A) { sum += vals[r++]; sum -= vals[l++]; } else { break; } } if (A <= sum && sum <= 2 * A) { vi ans(K); rep(i, K) { ans[i] = l + i + 1; } answer(ans); return; } else { int i = 0; while (i < N && vals[i] < A) i++; if (K <= i && i < N) { ll sum = 0; rep(j, K - 1) { sum += vals[j]; } sum += vals[i]; if (A <= sum && sum <= 2 * A) { vi ans(K); rep(j, K - 1) { ans[j] = j + 1; } ans[K - 1] = i + 1; 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...