Submission #516586

#TimeUsernameProblemLanguageResultExecution timeMemory
516586jk410Semiexpress (JOI17_semiexpress)C++17
100 / 100
10 ms4552 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...