Submission #889523

# Submission time Handle Problem Language Result Execution time Memory
889523 2023-12-19T22:24:14 Z Marco_Escandon Semiexpress (JOI17_semiexpress) C++11
0 / 100
1 ms 432 KB
#include<bits/stdc++.h>
using namespace std;
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(15);
#pragma GCC optimize("Ofast")
typedef long long ll;
ll n,m,k,a,b,c,t;
struct algo
{
    ll cost;
    ll p;
    ll g;
    ll mp;
    ll tr;
    friend bool operator < (algo a, algo b)
    {
        if(a.cost!=b.cost)
            return a.cost<b.cost;
        return a.g<b.g;
    }
};

int main()
{
    cin>>n>>m>>k>>a>>b>>c>>t;
    ll cad[m+1];
    ll cont=0;
    priority_queue<algo> q;
    for(int i=0; i<m; i++)
        cin>>cad[i];
    cad[m]=cad[m-1]+1;
    for(int i=0; i<m; i++)
    {
        if(t-cad[i]*b>=0)
        {
            q.push({1,cad[i]-1,min((t-(cad[i]-1)*b)/a+1,cad[i+1]-cad[i]),cad[i+1]-1,t-(cad[i]-1)*b});
        }
        else k--;
    }
    while(k&&!q.empty())
    {
        algo temp=q.top();q.pop();
        if(temp.tr<0) continue;
        //cout<<temp.p<<" "<<temp.g<<" "<<temp.tr<<"\n";
        cont+=temp.g;
        q.push({0,temp.p+temp.g,min((temp.tr-(temp.g)*c)/a+1,temp.mp-(temp.p+temp.g)),temp.mp,temp.tr-(temp.g)*c});
        k--;
    }
    cout<<cont-1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -