This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << ' ' <<
#define nl << '\n'
int n, m, k, a, b, c, t, s[3000], ans, pre;
priority_queue<int> q;
void add(int v, bool y){
ans += v;
if(!y) return;
q.push(-v);
if((int)q.size() > k-m) ans += q.top(), q.pop();
}
signed main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> m >> k >> a >> b >> c >> t;
for(int i=0; i<m; ++i) cin >> s[i];
for(int i=0; i+1<m; ++i){
int time = pre, diff = s[i+1] - s[i];
for(int j=0; j<=k-m; ++j){
int v = min(diff, (t - time + a) / a);
if(v < 0) break;
add(v, j);
diff -= v;
time += v * c;
}
pre += (s[i+1] - s[i]) * b;
}
if(pre <= t) add(1, 0);
cout << ans - 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |