Submission #667393

#TimeUsernameProblemLanguageResultExecution timeMemory
667393someoneA Difficult(y) Choice (BOI21_books)C++14
20 / 100
239 ms716 KiB
#include "books.h" #include <bits/stdc++.h> #define ll long long using namespace std; const int MAXN = 2e5 + 42; ll val[MAXN]; ll get(int i) { if(val[i] == 0) val[i] = skim(i); return val[i]; } void solve(int N, int K, ll A, int S) { for(int i = 1; i <= N; i++) get(i); vector<int> ans; ll sum = 0; for(int i = 1; i <= K; i++) sum += val[i]; int last = K; for(int i = K; i <= N; i++) { last = i; if(i == N || sum + val[i+1] - val[K] > 2*A) i = N+1; } for(int i = K; i > 0; i--) { if(sum + val[last + i - K] - val[i] <= 2*A) { sum += val[last + i - K] - val[i]; ans.push_back(last + i - K); } if(sum >= A) { for(int j = 1; j < i; j++) ans.push_back(j); 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...