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;
#define ll long long
#define fastio ios_base::sync_with_stdio(false)
#define endl "\n"
const ll lmt=3e4;
ll n,m,k,a,b,c,t,s[lmt],ans;
int main(){
fastio;
cin>>n>>m>>k>>a>>b>>c>>t;
for(int i=1;i<=m;i++){
cin>>s[i];
}
vector<ll>big;
k-=m;
if((n-1)*b<=t) ans++;
for(int i=1;i<m;i++){
ll last=(s[i]-1)*b;
if(last>t) break;
ll seat=(t-last)/a;
ll seg=min(s[i+1]-1,s[i]+seat);
ans+=(seg-s[i]+1);
if(i==1) ans--;
seg++;
for(int j=1;j<=k && seg<s[i+1];j++){
ll tme=last+(seg-s[i])*c;
if(tme>t) break;
ll seat2=(t-tme)/a;
ll seg2=min(s[i+1]-1,seg+seat2);
seg2++;
big.push_back(seg2-seg);
seg=seg2;
}
}
sort(big.begin(),big.end());
for(int i=0;i<min(k,(ll)big.size());i++){
ans+=big[i];
}
cout<<ans<<endl;
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... |