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 "holiday.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
long long int findMaxAttraction(int n, int start, int d, int ar[]) {
long long ans = 0;
for(int i = 0; i <= start; i ++){
for(int j = start; j < n; j ++){
int lenA = (start - i), lenB = (j - start);
int cnt = d - lenA - lenB - min(lenA, lenB);
vector <int> vec;
for(int k = i; k <= j; k ++)
vec.push_back(ar[k]);
sort(vec.rbegin(), vec.rend());
long long ret = 0;
for(int k = 0; k < min( (int)vec.size(), cnt ); k ++)
ret += vec[k];
ans = max(ans, ret);
}
}
return ans;
}
# | 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... |