Submission #889523

#TimeUsernameProblemLanguageResultExecution timeMemory
889523Marco_EscandonSemiexpress (JOI17_semiexpress)C++11
0 / 100
1 ms432 KiB
#include<bits/stdc++.h> using namespace std; #define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(15); #pragma GCC optimize("Ofast") typedef long long ll; ll n,m,k,a,b,c,t; struct algo { ll cost; ll p; ll g; ll mp; ll tr; friend bool operator < (algo a, algo b) { if(a.cost!=b.cost) return a.cost<b.cost; return a.g<b.g; } }; int main() { cin>>n>>m>>k>>a>>b>>c>>t; ll cad[m+1]; ll cont=0; priority_queue<algo> q; for(int i=0; i<m; i++) cin>>cad[i]; cad[m]=cad[m-1]+1; for(int i=0; i<m; i++) { if(t-cad[i]*b>=0) { q.push({1,cad[i]-1,min((t-(cad[i]-1)*b)/a+1,cad[i+1]-cad[i]),cad[i+1]-1,t-(cad[i]-1)*b}); } else k--; } while(k&&!q.empty()) { algo temp=q.top();q.pop(); if(temp.tr<0) continue; //cout<<temp.p<<" "<<temp.g<<" "<<temp.tr<<"\n"; cont+=temp.g; q.push({0,temp.p+temp.g,min((temp.tr-(temp.g)*c)/a+1,temp.mp-(temp.p+temp.g)),temp.mp,temp.tr-(temp.g)*c}); k--; } cout<<cont-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...