이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int DIM = 3005;
long long pos[DIM], cnt[DIM];
int main(void) {
#ifdef HOME
freopen("semiexpress.in", "r", stdin);
freopen("semiexpress.out", "w", stdout);
#endif
long long n, m, k, a, b, c, t;
cin >> n >> m >> k >> a >> b >> c >> t; k -= m;
for (int i = 1; i <= m; ++i) {
cin >> pos[i]; --pos[i];
if (t - pos[i] * b < 0) { cnt[i] = -1; }
else { cnt[i] = (t - pos[i] * b) / a; } }
cnt[m] = min(cnt[m], 0LL);
for (int i = 1; i < m; ++i) {
cnt[i] = min(cnt[i], pos[i + 1] - pos[i] - 1); }
while (k--) {
long long vl = 0, ps = -1;
for (int i = 1; i < m; ++i) {
if (t - pos[i] * b - (cnt[i] + 1) * c < 0) {
continue; }
long long st = cnt[i] + 1,
en = min(pos[i + 1] - pos[i] - 1, (t - pos[i] * b - st * c) / a + st);
if (vl < en - st + 1) {
vl = en - st + 1; ps = i; } }
cnt[ps] += vl; }
long long ans = -1;
for (int i = 1; i <= m; ++i) {
ans += cnt[i] + 1; }
cout << ans;
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... |