답안 #692030

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
692030 2023-02-01T05:21:40 Z Cookie197 Semiexpress (JOI17_semiexpress) C++17
100 / 100
12 ms 9608 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define endl "\n"
#define out(x) cout<< #x << " = " << x << endl
#define mp make_pair
#define mt(a,b,c,d) mp(mp(a,b),mp(c,d)) 

ll n,m,k;
ll a,b,c,t,arr[3005],ans;
vector<ll> v[3005];
signed main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>m>>k>>a>>b>>c>>t;
    for (int i=1;i<=m;i++) cin>>arr[i];
    
    if (b * arr[m] - b <= t) ans++;
    for (int i=1;i<m;i++){
        ll bt = b * (arr[i] - 1);
        if (bt > t) break;
        ll okstations = min((t-bt)/a + 1, arr[i+1] - arr[i]);
        ans += okstations; 
        if (okstations == (arr[i+1] - arr[i])) continue;
        

        ll nowstation = arr[i] + okstations;
        bt += okstations * c;
        for (int j=1;j<=k-m;j++){
            if (bt > t) break;
            okstations = min((t-bt)/a + 1, arr[i+1] - nowstation);
            v[i].push_back(okstations);
            if (okstations == (arr[i+1] - nowstation)) break;

            nowstation += okstations;
            bt += okstations * c;
        }
    }
    

    priority_queue<ll,vector<ll> > pq;
    for (int i=1;i<m;i++){
        //cout<<i<<" : ";
        for (ll u:v[i]) pq.push(u);//, cout<<u<<" ";
        //cout<<endl;
    }
    
    for (int i=1;i<=k-m;i++) if (pq.size()) ans += pq.top(),pq.pop();
    cout<<ans-1<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 400 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 400 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 392 KB Output is correct
13 Correct 1 ms 400 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 392 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 400 KB Output is correct
8 Correct 1 ms 392 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 392 KB Output is correct
13 Correct 1 ms 400 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 392 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 392 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 724 KB Output is correct
23 Correct 12 ms 9608 KB Output is correct
24 Correct 1 ms 468 KB Output is correct
25 Correct 1 ms 400 KB Output is correct
26 Correct 1 ms 428 KB Output is correct
27 Correct 1 ms 404 KB Output is correct
28 Correct 1 ms 528 KB Output is correct
29 Correct 9 ms 8516 KB Output is correct
30 Correct 5 ms 4188 KB Output is correct