Submission #516586

# Submission time Handle Problem Language Result Execution time Memory
516586 2022-01-21T14:07:06 Z jk410 Semiexpress (JOI17_semiexpress) C++17
100 / 100
10 ms 4552 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,M,K,A,B,C,T,Ans;
ll S[3001];
priority_queue<ll> Q;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>N>>M>>K>>A>>B>>C>>T;
    for (int i=1; i<=M; i++)
        cin>>S[i];
    for (int i=1; i<M; i++){
        ll t=B*(S[i]-1);
        if (t>T)
            continue;
        ll x=(T-t)/A+S[i];
        Ans+=min(x,S[i+1]-1)-S[i]+1;
        if (x>=S[i+1])
            continue;
        for (int j=0; j<K-M&&x<S[i+1]; j++){
            if (T<t+(x+1-S[i])*C)
                break;
            ll y=(T-t-(x+1-S[i])*C)/A+x+1;
            Q.push(min(y,S[i+1]-1)-x);
            x=y;
        }
    }
    if (B*(N-1)>T)
        Ans--;
    for (int i=0; i<K-M&&!Q.empty(); i++){
        Ans+=Q.top();
        Q.pop();
    }
    cout<<Ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 592 KB Output is correct
23 Correct 10 ms 4552 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 5 ms 4540 KB Output is correct
30 Correct 3 ms 2492 KB Output is correct