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 N = 3000 + 7;
ll stat[N];
ll n, m, k, a, b, c, t;
int main() {
#ifdef ONPC
freopen("input.txt", "r", stdin);
#endif // ONPC
#ifndef ONPC
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC
cin >> n >> m >> k >> a >> b >> c >> t;
for (int i = 0; i < m; i++) {
cin >> stat[i];
}
ll sol = 0;
if ((n - 1) * b <= t) {
sol++;
}
priority_queue<ll> pq;
for (int i = 0; i < m - 1; i++) {
ll tt = (stat[i] - 1) * b;
if (tt > t) break;
ll add = (t - tt) / a;
ll range = min(stat[i + 1] - 1, stat[i] + add);
sol += range - stat[i] + (i > 0);
for (int j = 0; j < k && range < stat[i + 1] - 1; j++) {
ll tmp = tt + (range + 1 - stat[i]) * c;
if (tmp > t) break;
ll qq = (t - tmp) / a;
ll new_range = min(stat[i + 1] - 1, range + qq + 1);
pq.push(new_range - range);
range = new_range;
}
}
for (int i = 1; i <= k - m; i++) {
if (!pq.empty()) {
sol += pq.top();
pq.pop();
}
}
cout << sol << "\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... |