# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
743772 | LCJLY | Semiexpress (JOI17_semiexpress) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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+(range-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;
}