Submission #972077

#TimeUsernameProblemLanguageResultExecution timeMemory
97207712345678Semiexpress (JOI17_semiexpress)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int nx=3e3+5; ll n, m, k, a, b, c, t, s[nx], res, x; priority_queue<ll> pq; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>m>>k>>a>>b>>c>>t; for (int i=1; i<=m; i++) cin>>s[i]; res=(((s[m]-1)*b)<=t)-1; for (int i=1; i<m; i++) { ll cur=(s[i]-1)*b; if (cur>t) break; ll lst=(t-cur)/a+s[i]; lst=min(lst, s[i+1]-1); res+=lst-s[i]+1; //cout<<"express "<<lst<<'\n'; for (int j=1; j<k-m; j++) { ll st=lst+1; if (st>=s[i+1]) break; ll dist=(st-s[i])*c+cur; if (t<dist) break; ll cnt=(t-dist)/a; ll ed=st+cnt; ed=min(ed, s[i+1]-1); //cout<<"debug "<<i<<' '<<j<<' '<<' '<<dist<<' '<<st<<' '<<ed<<'\n'; pq.push(ed-st+1); lst=ed; } } x=k-m; while (!pq.empty()&&x--) res+=pq.top(), pq.pop(); cout<<res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...