# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
562251 | dattranxxx | Semiexpress (JOI17_semiexpress) | C++11 | 0 ms | 212 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;
void file() {
const string FILE_NAME = "FILE_NAME";
freopen((FILE_NAME + ".inp").c_str(), "r", stdin);
freopen((FILE_NAME + ".out").c_str(), "w", stdout);
}
const int N = 3000 + 5;
ll a[N], c[N];
int n, _, k, A, B, C, T;
int get(int i, ll t, ll D) {
// trong tg t thi den dc bn trong khoang [a[i] + 1, a[j] - 1]
if (t < 0) return 0;
int nxt = min(a[i] + t / D, a[i+1] - 1);
return nxt - a[i] + 1;
}
int main() {
cin.tie(0)->sync_with_stdio(0); cout.tie(0);
cin >> _ >> n >> k;
cin >> A >> B >> C;
cin >> T;
for (int i = 0; i < n; ++i)
cin >> a[i];
int res = 0;
for (int i = 0; i < n-1; ++i) {
int b = get(i, T - a[i] * B, A), d = get(i, T - a[i] * B, C);
res += b; c[i] = d - b;
}
sort(c, c + n, greater<int>());
k -= n;
for (int i = 0; i < k && c[i] > 0; ++i)
res += c[i];
cout << res;
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... |