Submission #854621

#TimeUsernameProblemLanguageResultExecution timeMemory
854621willychanSemiexpress (JOI17_semiexpress)C++14
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; //#include<bits/extc++.h> //__gnu_pbds int main(){ ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n,m,k;cin>>n>>m>>k; k-=m; int a,b,c;cin>>a>>b>>c; int T;cin>>T; vector<ll> stop(m); for(int i=0;i<m;i++){ cin>>stop[i]; stop[i]--; } priority_queue<pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > pq; ll ans = n; for(int i=1;i<m;i++){ ll st = stop[i-1]*b; ll dif = T-st; pair<ll,ll> d; d = {stop[i-1]+(dif/a)+1,stop[i]}; if(dif<=0) d = {stop[i-1],stop[i]}; if(d.second>d.first){ ans-=d.second-d.first; pq.push(d); } } if((n-1)*b>T) ans--; for(int i=0;i<k;i++){ while(pq.size() && pq.top().first>=pq.top().second) pq.pop(); if(!pq.size()) break; pair<ll,ll> d = pq.top(); //cout<<d.first<<" "<<d.second<<"\n"n; pq.pop(); ll tt = d.first*c; if(tt>T){k++;continue;} pair<ll,ll> nd = {d.first+((T-tt)/a)+1,d.second}; if(nd.first>=d.second) ans+=d.second-d.first; else{ ans+=nd.first-d.first; pq.push(nd); } } cout<<ans<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...