Submission #397062

#TimeUsernameProblemLanguageResultExecution timeMemory
397062wildturtleSemiexpress (JOI17_semiexpress)C++14
0 / 100
1 ms304 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]*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...