제출 #397067

#제출 시각아이디문제언어결과실행 시간메모리
397067wildturtleSemiexpress (JOI17_semiexpress)C++14
100 / 100
69 ms19908 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll a,b,c,d,i,e,f,g,n,m,k,l,t,A[500005],l1,l2,ans,t1,t2; multiset<ll> ms; int main() { cin>>n>>m>>k; cin>>a>>b>>c; cin>>t; for(ll i=1;i<=m;i++) { cin>>A[i]; } for(ll i=1;i<m;i++) { t1=t-b*(A[i]-1); if(t1<0) break; //cout<<i<<" "<<t-b*(A[i]-1)<<" "; l=min(A[i]+(t1/a),A[i+1]-1); ans+=(l-A[i]+1); if(i==1) ans--; //cout<<ans<<endl; f=1; l1=A[i]; l++; t2=t1; while(l<=A[i+1]-1 && f<=(k-m)) { t2-=c*(l-l1); if(t2<0) break; //cout<<l<<" "<<l1<<endl; l2=min(A[i+1]-1,l+(t2/a)); ms.insert(-(l2-l+1)); l1=l; l=l2+1; f++; } } if((A[m]-1)*b<=t) ans++; f=1; while(ms.size() && f<=(k-m)) { f++; ans-=*ms.begin(); ms.erase(ms.find(*ms.begin())); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...