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;
vector <long long> Ve;
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
long long N, M, A, B, C, T, Su, k, Re=0;
int K;
cin >> N >> M >> K;
K -= M;
cin >> A >> B >> C >> T;
long long S[M];
cin >> S[0];
for (int i = 1; i < M; i++)
{
cin >> S[i];
Su = (S[i-1]-1)*B;
if (Su <= T)
{
k = (T-Su) / A;
long long ks = k+1, Mks=S[i]-S[i-1];
Re += min(k+1, Mks);
for (int y = 1; y <= K; y++)
{
if (Su + ks*C > T)
{
break;
}
k = (T-Su-ks*C) / A;
Ve.push_back(max(0ll, min(k+1, Mks-ks)));
ks += k+1;
}
}
}
if ((S[M-1]-1)*B <= T)
{
Re++;
}
sort(Ve.rbegin(),Ve.rend());
int VeS = Ve.size();
for (int i = 0; i < min(K, VeS); i++)
{
Re += Ve[i];
}
cout << Re - 1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |