Submission #889541

# Submission time Handle Problem Language Result Execution time Memory
889541 2023-12-20T00:57:21 Z Marco_Escandon Semiexpress (JOI17_semiexpress) C++11
100 / 100
1 ms 604 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 ip;
    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++)
    {
        ll temp=t-(cad[i]-1)*b;
        q.push({1,cad[i],min(temp/a,cad[i+1]-cad[i]-1),cad[i],cad[i+1],temp});
    }
    while(k&&!q.empty())
    {
        k--;
        algo temp=q.top();q.pop();
        if(temp.tr<0) continue;
        cont++;
        cont+=temp.g;
        ll asd=t-(temp.ip-1)*b-(temp.p+temp.g-temp.ip+1)*c;
        q.push({0,temp.p+temp.g+1,min(asd/a,temp.mp-temp.p-temp.g-1-1),temp.ip,temp.mp,asd});
    }
    cout<<cont-1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 604 KB Output is correct
20 Correct 1 ms 604 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 1 ms 604 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 436 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 0 ms 348 KB Output is correct