Submission #972077

# Submission time Handle Problem Language Result Execution time Memory
972077 2024-04-30T03:47:52 Z 12345678 Semiexpress (JOI17_semiexpress) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=3e3+5;

ll n, m, k, a, b, c, t, s[nx], res, x;
priority_queue<ll> pq;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m>>k>>a>>b>>c>>t;
    for (int i=1; i<=m; i++) cin>>s[i];
    res=(((s[m]-1)*b)<=t)-1;
    for (int i=1; i<m; i++) 
    {
        ll cur=(s[i]-1)*b;
        if (cur>t) break;
        ll lst=(t-cur)/a+s[i];
        lst=min(lst, s[i+1]-1);
        res+=lst-s[i]+1;
        //cout<<"express "<<lst<<'\n';
        for (int j=1; j<k-m; j++)
        {
            ll st=lst+1;
            if (st>=s[i+1]) break;
            ll dist=(st-s[i])*c+cur;
            if (t<dist) break;
            ll cnt=(t-dist)/a;
            ll ed=st+cnt;
            ed=min(ed, s[i+1]-1);
            //cout<<"debug "<<i<<' '<<j<<' '<<' '<<dist<<' '<<st<<' '<<ed<<'\n';
            pq.push(ed-st+1);
            lst=ed;
        }
    }
    x=k-m;
    while (!pq.empty()&&x--) res+=pq.top(), pq.pop();
    cout<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -