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;
typedef long long ll;
const int MX = 3005;
ll N, M, K;
ll A, B, C, T;
ll s[MX];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> N >> M >> K;
cin >> A >> B >> C;
cin >> T;
for(int i = 1; i <= M; i++) cin >> s[i];
ll ans = -1, cur = 0;
K -= M;
vector<ll> v;
for(int i = 1; i < M; i++) {
if(cur > T) break;
ll ccur = cur, pos = s[i];
for(int j = 0; j <= K; j++) {
if(ccur > T) break;
ll d = min(s[i + 1] - pos, (T - ccur) / A + 1);
if(!j) ans += d;
else v.push_back(d);
if((T - ccur) / A + 1 >= s[i + 1] - s[i]) break;
ccur += C * d;
pos += d;
}
cur += B * (s[i + 1] - s[i]);
}
if(cur <= T) ans += 1;
sort(v.rbegin(), v.rend());
for(int i = 0; i < K; i++) ans += v[i];
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... |