Submission #581150

#TimeUsernameProblemLanguageResultExecution timeMemory
581150l_rehoA Difficult(y) Choice (BOI21_books)C++14
0 / 100
12 ms428 KiB
#include <bits/stdc++.h> #include "books.h" #include<vector> #include<cstdio> #include<set> #include<cstdlib> #include<cstdarg> #include<cassert> #include<bits/stdc++.h> typedef long long ll; using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // void solve(int N, int K, long long A, int S) { // TODO implement this function vector<long long> vals; for(int i = 1; i <= N; i++){ long long curr_diff = skim(i); vals.push_back(curr_diff); } ll sum = 0; deque<int> ans; vector<int> res; for(int i = 0; i < K; i++){ ans.push_back(i+1); sum += vals[i]; } if(sum >= A && sum <= 2*A){ for(int i = 0; i < K; i++) res.push_back(ans[i]); answer(res); } ans.pop_back(); sum -= vals[K-1]; for(int j = 0; j <= N-K; j++){ for(int i = j+K-1; i < N; i++){ sum += vals[i]; ans.push_back(i+1); // test if(sum >= A && sum <= 2*A){ for(int k = 0; k < K; k++) res.push_back(ans[k]); answer(res); } if(sum > 2*A) break; sum -= vals[i]; ans.pop_back(); } sum -= vals[j]; ans.pop_front(); sum += vals[j+K-1]; ans.push_back(j+K); } 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...