Submission #875618

# Submission time Handle Problem Language Result Execution time Memory
875618 2023-11-20T08:02:32 Z vjudge1 Semiexpress (JOI17_semiexpress) C++17
0 / 100
1 ms 348 KB
// https://oj.uz/problem/view/JOI17_semiexpress

#include <bits/stdc++.h>
using namespace std;

int32_t main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);

        int n, m, k;
        cin >> n >> m >> k;
        int a, b, c;
        cin >> a >> b >> c;
        int64_t t;
        cin >> t;
        vector<int> s(m);
        for (int i = 0; i < m; i++) cin >> s[i], s[i]--;
        s.emplace_back(n);
        k -= m;
        vector<vector<int>> add(m, vector<int>(k + 1));
        for (int i = 0; i < m; i++) {
                int64_t cur_time = 1ll * s[i] * b;
                int64_t cur_pos = s[i];
                int j = 0;
                while (cur_time <= t && cur_pos < s[i + 1] && j <= k) {
                        int64_t time_left = t - cur_time;
                        int64_t more = time_left / a;
                        cur_pos += more;
                        cur_pos = min<int64_t>(cur_pos, s[i + 1] - 1);
                        add[i][j] = max<int64_t>(j ? add[i][j - 1] : 0, cur_pos - s[i] + 1);
                        j++;
                        cur_pos++;
                        cur_time = 1ll * s[i] * b + 1ll * (cur_pos - s[i]) * c;
                }
        }
        vector<int> cur(m, 1);
        priority_queue<pair<int, int>> pq;
        int res = 0;
        for (int i = 0; i < m; i++) pq.emplace(add[i][1], i), res += add[i][0];
        int remain = k;
        while (pq.size() && remain > 0) {
                auto [v, i] = pq.top();
                pq.pop();
                remain--;
                res += add[i][cur[i]] - add[i][cur[i] - 1];
                cur[i]++;
                if (cur[i] > k) continue;
                pq.emplace(add[i][cur[i]], i);
        }
        cout << res - 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -