Submission #669124

# Submission time Handle Problem Language Result Execution time Memory
669124 2022-12-05T19:29:43 Z Dec0Dedd Semiexpress (JOI17_semiexpress) C++14
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define pp pair<ll, pii>

const int M = 3e3+1;

ll s[M], n, m, k;
ll a, b, c, t;

int main() {
    cin>>n>>m>>k; k-=m;
    cin>>a>>b>>c>>t;
    for (int i=1; i<=m; ++i) cin>>s[i];

    priority_queue<pp> pq;
    ll ans=-1;
    for (int i=1; i<m; ++i) {
        ll tmp=b*(s[i]-1), x=(t-tmp)/a;
        if (s[i]+x >= s[i+1]) x=s[i+1]-s[i]-1;
        ans+=x+1;
        ll nxt=s[i]+x+1;
        
        ll sz=s[i+1]-nxt, cost=tmp+(nxt-s[i])*c, h=(t-cost)/a;

        if (min(sz, h) <= 0) continue; 
        pq.push({min(sz, h), {i, nxt}});
    }

    while (k--) {
        pp x=pq.top(); pq.pop();
        int i=x.second.first, nxt=x.second.second;
        ans+=x.first; nxt+=x.first;

        ll sz=s[i+1]-nxt, cost=b*(s[i]-1)+(nxt-s[i])*c, h=(t-cost)/a;
        if (min(sz, h) <= 0) continue;
        else pq.push({min(sz, h), {i, nxt}});
    }

    if (c <= t) ++ans;
    cout<<ans<<"\n";
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -