Submission #734277

#TimeUsernameProblemLanguageResultExecution timeMemory
734277TheSahibA Difficult(y) Choice (BOI21_books)C++17
0 / 100
3 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(); } }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:22:14: warning: self-comparison always evaluates to true [-Wtautological-compare]
   22 |         if(A <= A && a <= 2 * A){
      |            ~ ^~ ~
#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...