#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MXN = 3003;
int n, m, k, A, B, C, S[MXN], arr[MXN*MXN], sz, ans;
ll T;
int32_t main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
cin >> n >> m >> k >> A >> B >> C >> T;
for(int i=1; i<=m; i++) cin >> S[i];
S[m+1] = n+1;
for(int i=1; i<=m; i++) {
ll cur = 1ll*(S[i]-1)*B;
if(cur>T) break;
ll cnt = min((T-cur)/A, 1ll*S[i+1]-S[i]-1);
int wh = S[i];
ans += cnt+1;
for(int j=0; wh+cnt+1<S[i+1] && j<k-m; j++) {
if(cur + (cnt+1)*C > T) break;
cur += (cnt+1)*C;
wh += cnt+1;
cnt = min((T-cur)/A, 1ll*S[i+1]-wh-1);
arr[sz++] = cnt+1;
}
}
int cnt = min(k-m, sz);
nth_element(arr, arr+sz-cnt, arr+sz);
for(int i=sz-cnt; i<sz; i++) ans += arr[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... |