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;
#define int long long
int n,m,k,a,b,c,t,s[3005];
int ans = -1;
vector<int>u;
void blabla(int len,int timp,int coef)
{
int ans2 = 0;
///am statii de la 0 la len, unde 0 e statia cu expres
if (timp < 0)
return;
if (coef < 0)
return;
if (len < 0)
return;
//cout << len << ' ' << timp << ' ' << coef << endl;
if (coef == k - m)
ans++;
else
ans2++;
int poz = timp / a + 1;
poz = min(poz,len + 1);
if (coef == k - m)
ans += poz - 1;
else
ans2 += poz - 1;
if (coef != k - m)
u.push_back(ans2);
len -= poz;
timp -= c * poz;
coef--;
blabla(len,timp,coef);
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m >> k >> a >> b >> c >> t;
for (int i = 1; i <= m; i++)
cin >> s[i];
for (int i = 1; i < m; i++)
{
blabla(s[i + 1] - s[i] - 1,t - b * (s[i] - 1),k - m);
}
sort(u.begin(),u.end());
reverse(u.begin(),u.end());
for (int i = 0; i < min(k - m,(int)u.size()); i++)
ans += u[i];
if ((n - 1) * b <= t)
ans++;
cout << ans;
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... |