Submission #684465

# Submission time Handle Problem Language Result Execution time Memory
684465 2023-01-21T10:02:30 Z Ronin13 Semiexpress (JOI17_semiexpress) C++14
100 / 100
9 ms 340 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;


int main(){
    ll n; cin >> n;
    ll m; cin >> m;
    ll k; cin >> k;
    ll a, b, c; cin >> a >> b >> c;
    ll t; cin >> t;
    ll s[m + 1];
    ll f[m + 1];
    ll ans = 0;
    for(int i = 1; i <= m; i++)
    cin >> s[i];
    for(int i = 1; i <= m; i++){

        if(i == m){
            continue;
        }
        ll x = (s[i] - 1) * b;
        if(x > t) f[i] = s[i];
        else{
            ll v = t - x;
            v /= a;
            v++;
            f[i] = s[i] + v;
        }
        f[i] = min(f[i], s[i + 1]);
        ans += f[i] - s[i];
    }
    if(s[m] * b - b <= t) ans++;

    k -= m;
    while(k--){
        ll mx, mxi = -1;
        mx = 0;
        for(int i = 1; i < m; i++){
            ll val = s[i] * b - b;
            val += (f[i] - s[i]) * c;
            if(val > t)
                continue;
            ll u = t - val;
            ll cnt = u / a;
            cnt++;
            cnt = min(cnt, s[i + 1] - f[i]);
            if(cnt > mx)
                mx = cnt, mxi = i;
        }
        ans += mx;
        if(mx){

            ll val = s[mxi] * b - b;
            val += (f[mxi] - s[mxi]) * c;
            ll u = t - val;
            u /= a;
            u++;
            u = min(u, s[mxi + 1] - f[mxi]);
            f[mxi] += u;
        }
    }
    cout << ans - 1;
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 296 KB Output is correct
19 Correct 3 ms 212 KB Output is correct
20 Correct 5 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 9 ms 316 KB Output is correct
24 Correct 1 ms 304 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 312 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct