Submission #624135

#TimeUsernameProblemLanguageResultExecution timeMemory
624135HanksburgerSemiexpress (JOI17_semiexpress)C++17
100 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; priority_queue<pair<long long, pair<long long, long long> > > pq; long long s[3005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, k, a, b, c, t, ans=-1; cin >> n >> m >> k >> a >> b >> c >> t; for (long long i=1; i<=m; i++) cin >> s[i]; for (long long i=1; i<m; i++) { if (b*(s[i]-1)>t) break; long long x=min(s[i+1], (t-b*(s[i]-1)+a*(s[i]+1))/a); long long y=min(s[i+1], (t-b*(s[i]-1)-c*(x-s[i])+a*(x+1))/a); // cout << "i x y " << i << ' ' << x << ' ' << y << '\n'; ans+=x-s[i]; // cout << "ans " << ans << '\n'; if (x<y) pq.push({y-x, {i, y}}); } if (b*(n-1)<=t) ans++; for (long long i=m; i<k; i++) { if (pq.empty()) break; ans+=pq.top().first; long long ind=pq.top().second.first; long long x=pq.top().second.second; long long y=min(s[ind+1], (t-b*(s[ind]-1)-c*(x-s[ind])+a*(x+1))/a); // cout << "ind x y " << ind << ' ' << x << ' ' << y << '\n'; pq.pop(); if (x<y) pq.push({y-x, {ind, y}}); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...