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;
typedef long long int ll;
ll sub1(int n, int start, int d, int attraction[]) {
ll toRet = 0;
for (int i = 0; i <= start; i++)
{
for (int j = start; j < n; j++)
{
int daysTravel = min(2*(j-start) + (start-i), 2*(start-i) + (j-start));
if (daysTravel >= d)
{
continue;
}
vector<int> v;
for (int k = i; k <= j; k++)
{
v.push_back(attraction[k]);
}
sort(v.rbegin(), v.rend());
ll thisToRet = 0;
for (int k = 0; k < min(d-daysTravel, int(v.size()) ); k++)
{
thisToRet += v[k];
}
toRet = max(toRet, thisToRet);
}
}
return toRet;
}
ll findMaxAttraction(int n, int start, int d, int attraction[]) {
if (n <= 20)
{
return sub1(n, start, d, attraction);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |