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
main() {
int n, m, k, a, b, c, t; cin >> n >> m >> k >> a >> b >> c >> t;
int s[m+1]; for(int i=0;i<m;i++) {cin>>s[i]; s[i]--;}
s[m] = s[m-1] + 1;
vector<int> v;
int ans = -1;
for(int i=0;i<m;i++) {
int cur = s[i];
for(int cnt=0;cnt<k-m && cur<s[i+1];cnt++) {
int nxt = (cur * (a-c) + s[i] * (c-b) + t) / a + 1;
// (7 * 5 + 5 * 2 + 25)/10
// 7 * 5 + 5 * 2 = 45
if(nxt <= cur) break;
nxt = min(nxt, s[i+1]);
if(cur == s[i]) ans += (nxt - cur);
else v.push_back(nxt-cur);
cur = nxt;
}
}
sort(v.begin(),v.end());
for(int i=1;i<=min((int)(v.size()),k-m);i++) ans += end(v)[-i];
cout << ans;
}
Compilation message (stderr)
semiexpress.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main() {
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |