Submission #366173

#TimeUsernameProblemLanguageResultExecution timeMemory
366173inluminasSemiexpress (JOI17_semiexpress)C++14
18 / 100
1 ms364 KiB
#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=3e3; 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; for(int i=1;i<=m;i++){ if(i==m && ((n-1)*b)<=t){ ans++; continue; } ll last=(s[i]-1)*b; if(last>t) continue; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...