# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422095 | 2021-06-09T17:31:35 Z | tengiz05 | Semiexpress (JOI17_semiexpress) | C++17 | 1 ms | 204 KB |
#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 = 0; 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |