Submission #530513

#TimeUsernameProblemLanguageResultExecution timeMemory
530513fadi57Semiexpress (JOI17_semiexpress)C++14
100 / 100
39 ms33304 KiB
#include<bits/stdc++.h> using namespace std; const int mx=100006; const int mx2=2e5+9; typedef long long ll; const int mod=998244353 ; const long long inf=1e8+10; ll n,m,k;ll s[mx]; int main(){ cin>>n>>m>>k; ll a,b,c;cin>>a>>b>>c; ll t;cin>>t;ll ans=0; for(int i=0;i<m;i++){ cin>>s[i]; } if((n-1)*b<=t) ans++; priority_queue<ll>q; for(int i=0;i<m-1;i++){ ll tim=(s[i]-1)*b; ll steps=(t-tim)/a; ll range=min(s[i]+steps,s[i+1]-1); if(tim>t){break;} ans+=(range-s[i]+1); // cout<<range<<endl; if(i==0){ans--;} for(int j=0;j<k&&range<s[i+1]-1;j++){ ll tim2=tim+(1+range-s[i])*c; if(tim2>t){break;} ll steps2=(t-tim2)/(a); ll range2=min(range+steps2+1,s[i+1]-1); q.push(range2-range); // cout<<range2<<" "; range=range2; } //cout<<endl; } for(int i=m;i<k;i++){ if(!q.empty()){ ans+=q.top(); q.pop(); } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...