| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 321659 | casperwang | Semiexpress (JOI17_semiexpress) | C++14 | 16 ms | 4580 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>
#define int long long
#define pb push_back
using namespace std;
const int MAXN = 3000;
int n, m, k;
int a, b, c;
int T;
int s[MAXN+2];
int ans;
vector <int> arr;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n >> m >> k;
cin >> a >> b >> c;
cin >> T;
for (int i = 1; i <= m; i++)
cin >> s[i], s[i]--;
s[m+1] = n;
for (int i = 1; i <= m; i++) {
if (b * s[i] > T) break;
int now = (T - b * s[i]) / a + 1;
int t = T - b * s[i];
int cnt = 0;
ans += min(now, s[i+1] - s[i]);
while (cnt < k-m && now < s[i+1] - s[i] && t - c * now >= 0) {
int tmp = (t - c * now) / a + 1;
arr.pb(min(tmp, s[i+1] - s[i] - now));
now += tmp;
cnt++;
}
}
sort(arr.begin(), arr.end(), greater<int>());
for (int i = 0; i < k-m && i < arr.size(); i++)
ans += arr[i];
cout << ans-1 << "\n";
}
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... | ||||
