Submission #749935

# Submission time Handle Problem Language Result Execution time Memory
749935 2023-05-29T01:42:10 Z Pring Semiexpress (JOI17_semiexpress) C++14
100 / 100
2 ms 436 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
typedef pair<int, int> pii;

const int MXN = 3005;
int n, m, k, A, B, C, T, a[MXN], ans;

struct P {
    int now, r, x, l;
    P() {
        now = 0;
        r = 0;
        x = 0;
        l = 0;
    }
    void calc() {
        if (x < 0) l = 0;
        else l = min(r, x / A + 1);
    }
    void push() {
        ans += l;
        r -= l;
        x -= C * l;
        calc();
    }
} p[MXN];

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin >> n >> m >> k >> A >> B >> C >> T;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        a[i]--;
    }
    a[m] = n;
    for (int i = 0; i < m; i++) {
        p[i].now = 0;
        p[i].r = a[i + 1] - a[i];
        p[i].x = T - a[i] * B;
        p[i].calc();
        // cout << p[i].now << ' ' << p[i].r << ' ' << p[i].x << ' ' << p[i].l << endl;
        p[i].push();
    }
    // cout << endl;
    // cout << ans << endl;
    // for (int i = 0; i < m; i++) cout << p[i].now << ' ' << p[i].r << ' ' << p[i].x << ' ' << p[i].l << endl;
    // cout << endl;
    for (int i = m; i < k; i++) {
        int bigid = 0;
        for (int j = 1; j < m; j++) {
            if (p[bigid].l < p[j].l) bigid = j;
        }
        p[bigid].push();
        // for (int j = 0; j < m; j++) cout << p[j].now << ' ' << p[j].r << ' ' << p[j].x << ' ' << p[j].l << endl;
        // cout << endl;
    }
    cout << ans - 1 << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 424 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 424 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 420 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 428 KB Output is correct
12 Correct 1 ms 424 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 424 KB Output is correct
15 Correct 1 ms 420 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 424 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 420 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 428 KB Output is correct
12 Correct 1 ms 424 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 424 KB Output is correct
15 Correct 1 ms 420 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 1 ms 428 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 436 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct