답안 #889540

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
889540 2023-12-20T00:55:48 Z Marco_Escandon Semiexpress (JOI17_semiexpress) C++11
100 / 100
2 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;
        //cout<<temp.cost<<" "<<temp.p<<" "<<temp.g<<" "<<temp.tr<<" "<<asd<<" "<<"\n";
        if(temp.p+temp.g+1>=temp.mp)
            continue;
        //cout<<temp.cost<<temp.p<<" "<<temp.p+temp.g+1<<" "<<min(asd/a,temp.mp-temp.p-temp.g-1-1)<<" "<<asd<<"\n";
        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;
}
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 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
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 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 604 KB Output is correct
22 Correct 1 ms 448 KB Output is correct
23 Correct 2 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct