Submission #743773

#TimeUsernameProblemLanguageResultExecution timeMemory
743773LCJLYSemiexpress (JOI17_semiexpress)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int>pii; int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int n,m,k,a,b,c,t; cin >> n >> m >> k; cin >> a >> b >> c; cin >> t; int arr[n+5]; for(int x=1;x<=n;x++){ cin >> arr[x]; } int counter=0; if((n-1)*b<=t) counter++; priority_queue<int>pq; for(int x=1;x<n-1;x++){ int timer=b*(arr[x]-1); if(timer>t) continue; int hold=(t-timer)/a; int target=min(arr[x+1]-1,hold+timer); counter+=(target-arr[x]); for(int y=0;y<k&&target<arr[x+1]-1;y++){ int hold2=timer+(target-arr[x]+1)*c; if(hold2>t) break; int hold3=(t-hold2)/a; int target2=min(arr[x+1]-1,target+hold3+1); pq.push(target2-target); target=target2; } } for(int x=m;x<k;x++){ if(pq.empty()) break; counter+=pq.top(); pq.pop(); } cout << counter-1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...