이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
int n, m, k; ll a, b, c, t, ans = 0;
cin >> n >> m >> k >> a >> b >> c >> t;
set<ll> S; priority_queue<tuple<ll, ll, ll>> pq;
for (int i = 1; i <= m; i++){
ll pos; cin >> pos;
S.insert(pos); pq.push({2e9, (pos - 1) * b, pos});
}
while (!pq.empty() and k){
ll dst, ti, pos; tie(dst, ti, pos) = pq.top(); pq.pop();
if (ti > t) continue;
if (dst == 2e9) dst = min((t - ti) / a, (pos == n) ? 0 : *S.upper_bound(pos) - pos - 1);
ans += dst + 1; k--;
pos += dst + 1; ti += (dst + 1) * c;
dst = min((t - ti) / a, *S.lower_bound(pos) - pos - 1);
if (dst >= 0) pq.push({dst, ti, pos});
}
cout<<ans - 1<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |