#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,d,i,e,f,g,n,m,k,l,t,A[500005],l1,l2,ans,t1,t2;
multiset<ll> ms;
int main() {
cin>>n>>m>>k;
cin>>a>>b>>c;
cin>>t;
for(ll i=1;i<=m;i++) {
cin>>A[i];
}
for(ll i=1;i<m;i++) {
t1=t-b*(A[i]-1);
if(t1<0) break;
//cout<<i<<" "<<t-b*(A[i]-1)<<" ";
l=min(A[i]+(t1/a),A[i+1]-1);
ans+=(l-A[i]+1);
if(i==1) ans--;
//cout<<ans<<endl;
f=1; l1=A[i]; l++; t2=t1;
while(l<=A[i+1]-1 && f<=(k-m)) {
t2-=c*(l-l1);
if(t2<0) break;
//cout<<l<<" "<<l1<<endl;
l2=min(A[i+1]-1,l+(t2/a));
ms.insert(-(l2-l+1));
l1=l; l=l2+1;
f++;
}
}
if(A[m]*b<=t) ans++;
f=1;
while(ms.size() && f<=(k-m)) {
f++;
ans-=*ms.begin();
ms.erase(ms.find(*ms.begin()));
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
304 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |