Submission #889541

#TimeUsernameProblemLanguageResultExecution timeMemory
889541Marco_EscandonSemiexpress (JOI17_semiexpress)C++11
100 / 100
1 ms604 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 ip; 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++) { ll temp=t-(cad[i]-1)*b; q.push({1,cad[i],min(temp/a,cad[i+1]-cad[i]-1),cad[i],cad[i+1],temp}); } while(k&&!q.empty()) { k--; algo temp=q.top();q.pop(); if(temp.tr<0) continue; cont++; cont+=temp.g; ll asd=t-(temp.ip-1)*b-(temp.p+temp.g-temp.ip+1)*c; q.push({0,temp.p+temp.g+1,min(asd/a,temp.mp-temp.p-temp.g-1-1),temp.ip,temp.mp,asd}); } cout<<cont-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...