#include <iostream>
#include <set>
using namespace std;
#define int long long
int s[3005];
signed main(){
int n, m, k, A, B, C, T, Ans = 0;
cin>>n>>m>>k>>A>>B>>C>>T;
for (int i=1;i<=m;i++)
cin>>s[i], s[i]--;
k -= m;
multiset<int> st;
for (int i=1;i<=m;i++){
if (s[i] * B > T){
m = i-1;
break;
}
Ans += (i > 1);
if (i == m)
break;
int tot = s[i+1] - s[i] - 1, lst = min(tot, (T - s[i] * B) / A);
Ans += lst;
for (int j=0;j<k;j++){
int nw = max(0LL, 1 + (T - s[i] * B - (lst + 1) * C) / A);
if (T - s[i] * B - (lst + 1) * C < 0)
nw = 0;
nw = min(nw, tot - lst);
st.insert(nw);
lst += nw;
}
}
while (k--){
Ans += *rbegin(st);
st.erase(prev(end(st)));
}
cout<<Ans<<'\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |