#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
semiexpress.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main() {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |