제출 #446864

#제출 시각아이디문제언어결과실행 시간메모리
446864wiwihoA Difficult(y) Choice (BOI21_books)C++14
20 / 100
302 ms456 KiB
#include <bits/stdc++.h> #include "books.h" #define eb emplace_back using namespace std; typedef long long ll; void ans(int st, int k){ vector<int> v(k); for(int i = 0; i < k; i++) v[i] = st + i; answer(v); } void solve(int n, int k, ll A, int S){ assert(n == S); vector<ll> x(n + 1); for(int i = 1; i <= n; i++){ x[i] = skim(i); } ll sum = 0; for(int i = 1; i <= k; i++) sum += x[i]; if(sum > 2 * A) impossible(); if(sum >= A) ans(1, k); int i; for(i = k + 1; i <= n && x[i] < A; i++){ sum -= x[i - k]; sum += x[i]; if(sum >= A){ assert(sum <= 2 * A); ans(i - k + 1, k); } } if(i == n + 1) impossible(); sum = x[i]; for(int j = 1; j < k; j++) sum += x[j]; if(sum <= 2 * A){ vector<int> v; for(int j = 1; j < k; j++) v.eb(j); v.eb(i); answer(v); } 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...