Submission #114095

#TimeUsernameProblemLanguageResultExecution timeMemory
114095popovicirobertSemiexpress (JOI17_semiexpress)C++14
18 / 100
2 ms384 KiB
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const ll INF = 1e18;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, m, k, a, b, c;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> m >> k >> a >> b >> c;
    // b < c < a

    ll t;
    cin >> t;

    vector <int> st(m + 1);
    for(i = 1; i <= m; i++) {
        cin >> st[i];
    }

    k -= m;
    int ans = 0, cnt = 0;

    for(i = 1; i < m; i++) {
        ll cur = 1LL * (st[i] - 1) * b;
        if(cur > t) {
            break;
        }

        ll x = st[i];

        while(x < st[i + 1]) {
            ll y = (x + (t - cur) / a);

            ans += min(y, 1LL * st[i + 1]) - x;

            if(y >= st[i + 1]) {
                x = y;
                break;
            }

            if(cnt < k) {
                cur += (y + 1 - x) * c;

                if(cur > t) {
                    break;
                }

                cnt++;
                ans++;
                x = y + 1;
            }
            else {
                x = y;
                break;
            }
        }

        if(x < st[i + 1] && 1LL * (st[i + 1] - 1) * b <= t) {
            ans++;
        }
    }

    cout << ans;

    //cin.close();
    //cout.close();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...