제출 #889548

#제출 시각아이디문제언어결과실행 시간메모리
889548shiomusubi496A Difficult(y) Choice (BOI21_books)C++17
20 / 100
167 ms600 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i) using ll = long long; void solve(int N, int K, long long A, int S) { assert(N == S); vector<ll> B(N); rep (i, N) B[i] = skim(i + 1); ll cur = 0; vector<int> ans{N}; rep (i, K) { rep (j, ans.back() - K + i + 1) { ll sm = 0; rep (k, K - i) sm += B[j + k]; if (cur + sm < A) continue; if (cur + sm <= 2 * A) { rep (k, K - i) ans.push_back(j + k); ans.erase(ans.begin()); for (int& x : ans) ++x; answer(ans); return; } ans.push_back(j + K - i - 1); cur += B[j + K - i - 1]; break; } if (ans.size() == i + 1) { impossible(); return; } } impossible(); }

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:34:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |         if (ans.size() == i + 1) {
      |             ~~~~~~~~~~~^~~~~~~~
#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...