# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
158104 | ZwariowanyMarcin | Semiexpress (JOI17_semiexpress) | C++14 | 550 ms | 67028 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.
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define mp make_pair
#define pb push_back
#define ld long double
#define ss(x) (int) x.size()
#define FOR(i, j, n) for(int i = j; i <= n; ++i)
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl;
#define ios cin.tie(0); ios_base::sync_with_stdio(0)
using namespace std;
int n, m, k;
int a, b, c;
ll T;
int s[3005];
ll ans = 0;
multiset <ll> secik;
int main() {
scanf("%d %d %d", &n, &m, &k);
k = k - m;
scanf("%d %d %d", &a, &b, &c);
scanf("%lld", &T);
FOR(i, 1, m)
scanf("%d", &s[i]);
FOR(i, 1, m) {
ll cash = (ll) (s[i] - 1) * b;
if(cash <= T && i > 1)
ans += 1;
if(i == m)
break;
ll ile = s[i + 1] - s[i] - 1;
ll happy = min(ile, max(1LL * 0, (T - cash) / a));
ile -= happy;
ans += happy;
ll people = happy;
FOR(j, 1, k) {
ll all = cash + (people + 1) * c;
happy = min(ile, max(1LL * 0, (T - all) / a + (all <= T)));
//cout << i << " " << j << " " << happy << " " << ile << " " << people << endl;
secik.insert(happy);
ile -= happy;
people += happy;
}
}
//cout << ans << endl;
while(k--) {
ll e = *(--secik.end());
ans += e;
secik.erase(--secik.end());
}
printf("%lld\n", ans);
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... |