#include <bits/stdc++.h>
#define ll long long
using namespace std;
int express[3005],endpos[3005];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N,M,K; cin >> N >> M >> K;
int A,B,C; cin >> A >> B >> C;
int T; cin >> T;
for(int i = 1;i<=M;++i){
cin >> express[i];
express[i]--;
endpos[i] = (T-express[i]*B)/A;
if(endpos[i] < 0) endpos[i] = -1;
}
for(int i = 1;i<M;++i) endpos[i] = min(endpos[i],express[i+1]-express[i]-1);
endpos[M] = min(endpos[M],0);
for(int i = 0;i<K-M;++i){
int maxn = 0, pos = -1;
for(int j = 1;j<M;++j){
if((T-express[j]*B-(endpos[j]+1)*C)/A < 0) continue;
int p = endpos[j]+1;
int chec = min(express[j+1]-express[j]-1,(T-express[j]*B-p*C)/A+p);
if(chec-p+1 > maxn){
maxn = chec-p+1;
pos = j;
}
}
if(maxn > 0){
endpos[pos] += maxn;
}
}
ll ans = 0;
for(int i = 1;i<=M;++i) ans += endpos[i]+1;
ans--;
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |