#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long n;
int m, k;
cin >> n >> m >> k;
long long a, b, c;
cin >> a >> b >> c;
long long t;
cin >> t;
vector<long long> s(m);
for (int i = 0; i < m; i++) {
cin >> s[i];
}
long long ans = 0;
if ((n - 1) * b <= t) {
ans++;
}
priority_queue<long long> pq;
for (int i = 0; i < m - 1; i++) {
long long need = (s[i] - 1) * b;
if (need > t) {
break;
}
long long q = (t - need) / a;
long long to = min(s[i] + q, s[i + 1] - 1);
ans += to - s[i] + 1;
for (int j = 0; j < k && to < s[i + 1] - 1; j++) {
long long tmp = need + (to - s[i] + 1) * c;
if (tmp > t) {
break;
}
q = (t - tmp) / a;
long long next = min(s[i + 1] - 1, to + q + 1);
pq.push(next - to);
to = next;
}
}
for (int i = 0; i < k - m && !pq.empty(); i++) {
ans += pq.top();
pq.pop();
}
ans--;
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
392 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
392 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
3 ms |
384 KB |
Output is correct |
19 |
Correct |
3 ms |
512 KB |
Output is correct |
20 |
Correct |
3 ms |
384 KB |
Output is correct |
21 |
Correct |
8 ms |
2552 KB |
Output is correct |
22 |
Correct |
6 ms |
1532 KB |
Output is correct |
23 |
Correct |
24 ms |
8844 KB |
Output is correct |
24 |
Correct |
21 ms |
4584 KB |
Output is correct |
25 |
Correct |
3 ms |
384 KB |
Output is correct |
26 |
Correct |
3 ms |
384 KB |
Output is correct |
27 |
Correct |
73 ms |
16860 KB |
Output is correct |
28 |
Correct |
92 ms |
33472 KB |
Output is correct |
29 |
Correct |
20 ms |
4596 KB |
Output is correct |
30 |
Correct |
9 ms |
2552 KB |
Output is correct |