Submission #396596

#TimeUsernameProblemLanguageResultExecution timeMemory
396596keta_tsimakuridzeSemiexpress (JOI17_semiexpress)C++14
100 / 100
2 ms336 KiB
#include<bits/stdc++.h> #define f first #define int long long #define s second using namespace std; const int N=2e5+5,mod=1e9+7; int t,s[N],ans; set<pair<int,pair<int,int> > > st; main(){ int n,m,k,a,b,c,T; cin>>n>>m>>k; cin>>a>>b>>c; cin>>T; for(int i=1;i<=m;i++){ cin>>s[i]; } if((s[m]-1)*b <=T)ans++; for(int i=1;i<m;i++){ int cur=s[i]; int timer=(s[i]-1)*b; if(timer>T) continue; ans += min(s[i+1]-s[i],(T-timer)/a+1); cur = s[i] + min(s[i+1]-s[i],(T-timer)/a+1); if(cur>=s[i+1]) continue; timer+=c*(cur-s[i]); if(timer> T) continue; st.insert({min(s[i+1]-cur,(T-timer)/a+1),{i,cur+min(s[i+1]-cur,(T-timer)/a+1)}}); } k-=m; while(k && st.size()){ pair<int,pair<int,int> > p = *--st.end(); int i = p.s.f; int adds=p.f; ans+=adds; int cur=p.s.s; int timer=(s[i]-1)*b+(cur-s[i])*c; st.erase(p); k--; if(timer>T || cur>=s[i+1]) continue; adds = min(s[i+1]-cur,(T-timer)/a+1); cur += adds; st.insert({adds,{i,cur}}); } cout<<ans-1; }

Compilation message (stderr)

semiexpress.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 |  main(){
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...