이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, m, k;
int a, b, c;
int t, extra;
const int MXM = 3005;
int pos[MXM];
int curr = 0;
signed main() {
cin >> n >> m >> k;
cin >> a >> b >> c;
cin >> t;
for (int i=1; i<=m; i++) {
cin >> pos[i];
}
extra = k - m;
priority_queue<int> pr;
for (int i=1; i<m; i++) {
int left = t - (pos[i] - 1) * b;
if (left < 0) continue;
int far = min(pos[i+1]-1, pos[i]+left/a);
curr += (far - pos[i] + 1);
int min_no = far + 1;
int here = 1;
bool can = true;
while (min_no < pos[i+1] && here <= extra && can) {
int ti = t - ((pos[i] - 1) * b + (min_no - pos[i]) * c);
if (ti >= 0) {
int far = min(min_no + ti / a, pos[i+1]-1);
int hm = far - min_no + 1;
pr.push(hm);
here++;
min_no = far + 1;
}
else {
can = false;
}
}
}
curr--;
{
if (t - (pos[m] - 1) * b >= 0) {
curr++;
}
}
int best = 0;
for (int i=0; i<extra; i++) {
if (!pr.empty()) {
best += pr.top();
pr.pop();
}
}
cout << best + curr << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |