Submission #396916

# Submission time Handle Problem Language Result Execution time Memory
396916 2021-05-01T01:28:13 Z timmyfeng Semiexpress (JOI17_semiexpress) C++17
100 / 100
15 ms 4548 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3000;

long long express[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    long long n, m, k, a, b, c, t;
    cin >> n >> m >> k >> a >> b >> c >> t;

    for (int i = 0; i < m; ++i) {
        cin >> express[i];
        --express[i];
    }

    long long ans = -1;
    vector<long long> semiexpress;
    for (int i = 0; i < m - 1; ++i) {
        long long x = express[i];
        for (int j = 0; j <= k - m; ++j) {
            if (x == express[i + 1] || b * express[i] + c * (x - express[i]) > t) {
                break;
            }

            long long remain = t - b * express[i] - c * (x - express[i]);
            long long y = min(express[i + 1], x + remain / a + 1);
            if (x == express[i]) {
                ans += y - x;
            } else {
                semiexpress.push_back(y - x);
            }
            x = y;
        }
    }
    ans += b * express[m - 1] <= t;

    sort(semiexpress.rbegin(), semiexpress.rend());
    for (int i = 0; i < k - m && i < (int) semiexpress.size(); ++i) {
        ans += semiexpress[i];
    }

    cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 320 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 2 ms 588 KB Output is correct
23 Correct 15 ms 4548 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 2 ms 332 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 3 ms 332 KB Output is correct
29 Correct 10 ms 4548 KB Output is correct
30 Correct 6 ms 2504 KB Output is correct