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;
typedef long long ll;
ll N,M,K,A,B,C,T,Ans;
ll S[3001];
priority_queue<ll> Q;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>N>>M>>K>>A>>B>>C>>T;
for (int i=1; i<=M; i++)
cin>>S[i];
for (int i=1; i<M; i++){
ll t=B*(S[i]-1);
if (t>T)
continue;
ll x=(T-t)/A+S[i];
Ans+=min(x,S[i+1]-1)-S[i]+1;
if (x>=S[i+1])
continue;
for (int j=0; j<K-M&&x<S[i+1]; j++){
if (T<t+(x+1-S[i])*C)
break;
ll y=(T-t-(x+1-S[i])*C)/A+x+1;
Q.push(min(y,S[i+1]-1)-x);
x=y;
}
}
if (B*(N-1)>T)
Ans--;
for (int i=0; i<K-M&&!Q.empty(); i++){
Ans+=Q.top();
Q.pop();
}
cout<<Ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |