Submission #292125

#TimeUsernameProblemLanguageResultExecution timeMemory
292125YJUSemiexpress (JOI17_semiexpress)C++14
100 / 100
1 ms512 KiB
#include<bits/stdc++.h> #pragma GCC optimize("unroll-loops,no-stack-protector") using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; const ll MOD=1e9+7; const ll MOD2=998244353; const ll N=2e5+5; const ld pi=3.14159265359; const ll INF=(1LL<<60); typedef pair<ll,pair<ll,pair<ll,pll> > > TY; #define SQ(i) ((i)*(i)) #define REP(i,n) for(ll i=0;i<n;i++) #define REP1(i,n) for(ll i=1;i<=n;i++) #define pb push_back #define mp make_pair #define X first #define Y second #define setp setprecision #define lwb lower_bound #define SZ(_a) (ll)_a.size() ll n,m,k,A,B,C,T,ans,s[N]; priority_queue<TY> pq; ll l,r,nl,nr,li,cost,ncost; ll R(ll c,ll st){ return st+1+(T-c)/A; } int main(){ ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>m>>k>>A>>B>>C>>T; REP(i,m)cin>>s[i]; s[m]=n+1; REP(i,m){ if(T<(s[i]-1)*B)continue; l=s[i];r=min(s[i+1],R((s[i]-1)*B,l)); ans+=r-l; ll tmp=(s[i]-1)*B+(r-l)*C; if(tmp<=T)pq.push(mp(min(s[i+1],R(tmp,r))-r,mp(tmp,mp(s[i+1],mp(r,min(s[i+1],R(tmp,r))))))); } REP(ti,k-m){ if(SZ(pq)==0)break; auto kk=pq.top();pq.pop(); l=kk.Y.Y.Y.X,r=kk.Y.Y.Y.Y,li=kk.Y.Y.X,cost=kk.Y.X; ans+=kk.X; if(cost+(r-l)*C>T)continue; ncost=cost+(r-l)*C; nl=r,nr=min(li,R(ncost,r)); pq.push(mp(nr-nl,mp(ncost,mp(li,mp(nl,nr))))); } cout<<max(ans-1,0LL)<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...