Submission #499353

# Submission time Handle Problem Language Result Execution time Memory
499353 2021-12-28T04:43:01 Z SirCovidThe19th Semiexpress (JOI17_semiexpress) C++17
48 / 100
2 ms 392 KB
#include <bits/stdc++.h>
using namespace std; 

#define ll long long
#define int ll

signed 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 (ti > t) continue;

        if (dst == 1e18) 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
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Incorrect 1 ms 392 KB Output isn't correct
22 Halted 0 ms 0 KB -