답안 #524056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524056 2022-02-08T14:49:20 Z FireGhost1301 Semiexpress (JOI17_semiexpress) C++11
100 / 100
6 ms 2504 KB
#include <bits/stdc++.h>
using namespace std;

const int M = 3000 + 3;
int n, m, k;
int a, b, c;
long long t;
int s[M];
priority_queue<int> pq;

void solve() {
    cin >> n >> m >> k, k -= m;
    cin >> a >> b >> c;
    cin >> t;
    for (int i = 1; i <= m; ++i)
        cin >> s[i];
    int ans = 0;
    for (int i = 1; i < m; ++i) {
        int x = s[i], z = -1;
        long long tme = 1LL * b * (s[i] - 1);
        for (;;) {
            if (tme > t || x >= s[i + 1]) break;
            long long tmp = min((t - tme) / a + x, 1LL * s[i + 1] - 1);
            if (z != -1) pq.push(tmp - x + 1);
            else ans += tmp - x + 1;
            tme += 1LL * c * (tmp - x + 1), x = tmp + 1;
            if (++z >= k) break;
        }
    }
    while (!pq.empty() && k--)
        ans += pq.top(), pq.pop();
    if (1LL * b * (s[m] - 1) <= t) ++ans;
    cout << ans - 1;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 0 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 0 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 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 0 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 0 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 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 316 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 1 ms 460 KB Output is correct
23 Correct 6 ms 2504 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 5 ms 2504 KB Output is correct
30 Correct 3 ms 1484 KB Output is correct