# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
595022 | piOOE | Semiexpress (JOI17_semiexpress) | C++17 | 232 ms | 262144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m, k;
cin >> n >> m >> k;
int a, b, c;
cin >> a >> b >> c; //slow, fast, middle
ll t;
cin >> t;
vector<int> s(m);
for (int i = 0; i < m; ++i) {
cin >> s[i];
}
vector<pair<int, bool>> v;
ll ans = 0;
s.push_back(n + 1);
for (int i = 0; i < (int)s.size() - 1; ++i) {
ll dist = (s[i] - 1) * b;
if (dist > t) {
break;
}
ll x = s[i];
while (x < s[i + 1] && dist <= t) {
ll nxt = (t - dist) / a;
if (x + nxt + 1 >= s[i + 1]) {
nxt = s[i + 1] - x - 1;
}
v.push_back({nxt + 1, x != s[i]});
dist += (nxt + 1) * c;
x += nxt + 1;
}
}
sort(v.begin(), v.end(), greater());
int cnt = m;
for (int i = 0; i < v.size(); ++i) {
if (cnt + v[i].second <= k) {
ans += v[i].first;
cnt += v[i].second;
}
}
cout << ans - 1;
return 0;
}
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... |