# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
205575 | Kastanda | Semiexpress (JOI17_semiexpress) | C++11 | 20 ms | 2540 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.
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3003;
int n, m, k, P[N];
ll A, B, C, T;
int main()
{
scanf("%d%d%d", &n, &m, &k);
scanf("%lld%lld%lld", &A, &B, &C);
scanf("%lld", &T);
for (int i = 1; i <= m; i ++)
scanf("%d", &P[i]);
int tot = 0;
for (int h = 2; h <= m; h ++)
if ((P[h] - 1) * B <= T)
tot ++;
vector < int > vec;
for (int h = 1; h < m; h ++)
if ((P[h] - 1) * B < T)
{
ll ri = P[h + 1];
ll Tm = T - (P[h] - 1) * B;
ll now = P[h];
ll tobe = min(now + Tm / A + 1, ri);
tot += tobe - now - 1;
int cur = 0;
while (now < ri && Tm >= (tobe - now) * C && cur < k - m)
{
cur ++;
Tm -= (tobe - now) * C;
now = tobe;
tobe = min(now + Tm / A + 1, ri);
vec.push_back(tobe - now);
}
}
sort(vec.begin(), vec.end());
reverse(vec.begin(), vec.end());
for (int i = 0; i < min(k - m, (int)vec.size()); i ++)
tot += vec[i];
return !printf("%d\n", tot);
}
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... |