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>
#include"holiday.h"
#define ALL(x) x.begin(),x.end()
#define LLA(x) x.rbegin(),x.rend()
#define pb push_back
using namespace std;
using PII = pair <int, int>;
using ll = long long;
long long int findMaxAttraction(int n, int start, int d, int nums[]) {
ll ans = 0;
for (int i = 0; i <= start; i++)
for (int j = start; j < n; j++) {
int l = start - i;
int r = j - start;
int move = l + r + min(l,r);
int need = d - move;
if (need <= 0) continue;
multiset <int> vals;
for (int p = 0; p < need; p++) vals.insert(0);
for (int p = i; p <= j; p++) {
vals.insert(nums[p]);
vals.erase(vals.begin());
}
ll cur = 0;
for (auto el : vals) cur += el;
ans = max(ans, cur);
}
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... |