Submission #422103

#TimeUsernameProblemLanguageResultExecution timeMemory
422103tengiz05Semiexpress (JOI17_semiexpress)C++17
100 / 100
14 ms4548 KiB
#include <bits/stdc++.h> using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); i64 n, m, k, A, B, C, T; std::cin >> n >> m >> k; std::cin >> A >> B >> C >> T; std::vector<i64> a(m); for (int i = 0; i < m; i++) { std::cin >> a[i]; a[i]--; } i64 ans = -1; std::vector<i64> seg; for (int i = 0; i < m - 1; i++) { i64 l = a[i]; for (int j = 0; j <= k - m; j++) { if (l == a[i + 1] || B * a[i] + C * (l - a[i]) > T) { break; } i64 left = T - B * a[i] - C * (l - a[i]); i64 r = std::min(a[i + 1], l + left / A + 1); if (l == a[i]) { ans += r - l; } else { seg.push_back(r - l); } l = r; } } ans += B * a[m - 1] <= T; sort(seg.rbegin(), seg.rend()); for (int i = 0; i < k - m && i < seg.size(); i++) { ans += seg[i]; } std::cout << ans << "\n"; return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:34:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for (int i = 0; i < k - m && i < seg.size(); i++) {
      |                                  ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...