# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1256427 | mingga | Semiexpress (JOI17_semiexpress) | C++20 | 11 ms | 4536 KiB |
// Author: caption_mingle
#include "bits/stdc++.h"
using namespace std;
#define ln "\n"
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define int long long
const int mod = 1e9 + 7;
const int inf = 2e9;
const int N = 3005;
int n, m, k, A, B, C, t, a[N];
signed main() {
cin.tie(0) -> sync_with_stdio(0);
#define task ""
if(fopen(task ".INP", "r")) {
freopen(task ".INP", "r", stdin);
freopen(task ".OUT", "w", stdout);
}
cin >> n >> m >> k >> A >> B >> C >> t;
for(int i = 1; i <= m; i++) {
cin >> a[i];
}
k -= m;
int ans = 0;
vector<int> cand;
for(int i = 1; i <= m; i++) {
int cur = a[i];
if(B * (cur - 1) > t) break;
int time_left = t - B * (cur - 1);
int mxA = time_left / A;
ans++;
if(i == m) break;
ans += min(mxA, a[i + 1] - a[i] - 1);
cur += min(mxA, a[i + 1] - a[i] - 1);
// cerr << "STATION " << i << ' ' << time_left << ' ' << a[i] << ' ' << mxA << ' ' << ln;
for(int j = 1; j <= k; j++) {
int pos = cur + 1;
if(pos >= a[i + 1]) break;
if(time_left < C * (pos - a[i])) break;
int time_left2 = time_left - C * (pos - a[i]);
int val = min(time_left2 / A, a[i + 1] - pos - 1) + 1;
// cerr << pos << ' ' << time_left2 << ' ' << val << ln;
cur += val;
cand.pb(val);
}
}
sort(all(cand), greater<int>());
for(int i = 0; i < min(k, sz(cand)); i++) ans += cand[i];
cout << ans - 1 << ln;
cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |