답안 #499357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
499357 2021-12-28T05:02:29 Z SirCovidThe19th Semiexpress (JOI17_semiexpress) C++17
100 / 100
3 ms 388 KB
#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({1e18, (pos - 1) * b, pos});
    }
    while (!pq.empty() and k){
        ll dst, ti, pos; tie(dst, ti, pos) = pq.top(); pq.pop();

        if (dst == 1e18){
            dst = min((t - ti) / a, (pos == n) ? 0 : (*S.upper_bound(pos) - pos - 1));
            if (ti > t){ k--; continue; }
        }
        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 and ti <= t) pq.push({dst, ti, pos});
    }
    cout<<ans - 1<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 288 KB Output is correct
18 Correct 1 ms 276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 288 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 288 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 288 KB Output is correct
18 Correct 1 ms 276 KB Output is correct
19 Correct 2 ms 292 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 2 ms 332 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 2 ms 332 KB Output is correct
24 Correct 1 ms 388 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 3 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 1 ms 292 KB Output is correct