#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;
const int mxn=1e5+5;
const int inf=1e9;
priority_queue<ll> pq;
ll a,b,c;
ll n,m,k;
ll t;
ll res = 0;
void prc(ll l,ll r) {
ll cost = (l - 1) * b;
if(cost > t) return;
ll td = (t - cost)/a;
ll i = min(r,l + td + 1);
res += i - l;
int cnt = 0;
while(cnt <= k - m && i < r) {
ll lc = cost + (i - l) * c;
if(lc > t) return;
ll x = (t - lc) / a;
ll to = min(r,i + x + 1);
pq.push(to - i);
i = to;
cnt++;
}
}
int main() {
cin >> n >> m >> k;
cin >> a >> b >> c;
cin>>t;
ll exp[m + 1];
for(int i = 1; i <= m; i++) cin >> exp[i];
for(int i = 2; i <= m; i++) prc(exp[i - 1],exp[i]);
for(int i = 1; i <= k - m && !pq.empty(); i++) {
res += pq.top();
pq.pop();
}
if(b * exp[m] <= t) res++;
cout<<res - 1<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Incorrect |
1 ms |
368 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Incorrect |
1 ms |
368 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
364 KB |
Output is correct |
7 |
Incorrect |
1 ms |
368 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |