#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n, m, k;
cin >> n >> m >> k;
ll a, b, c;
cin >> a >> b >> c;
k -= m;
ll t;
cin >> t;
vector <ll> s(m);
for (int i = 0; i < m; i++) {
cin >> s[i];
}
ll ans = 0;
vector <ll> bonus;
for (int i = 0; i < m - 1; i++) {
ll tm = (s[i] - 1) * (ll) b;
if (tm > t) {
break;
}
ans++;
ll stations = s[i + 1] - s[i] - 1;
ll rem = (t - tm) / a;
rem = min(rem, stations);
ans += rem;
ll prev = s[i] + rem;
for (int j = 0; j < k; j++) {
int cur = prev + 1;
if (cur >= s[i + 1]) {
break;
}
ll new_tm = (cur - s[i]) * (ll) c + tm;
if (new_tm > t) break;
stations = s[i + 1] - cur - 1;
rem = (t - new_tm) / a;
rem = min(rem, stations);
bonus.push_back(rem + 1);
prev = cur + rem;
}
}
if ((s[m - 1] - s[0]) * (ll) b <= t) {
ans++;
}
sort(bonus.rbegin(), bonus.rend());
for (int i = 0; i < max(k, (ll) bonus.size()); i++) {
ans += bonus[i];
}
cout << ans - 1 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |