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 <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
#define pb push_back
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll result = 0;
for (int i = 0; i <= start; ++i) {
for(int j = start; j<n; j++){
if(j-i+1>d) continue;
vi res;
for(int k = i; k<=j;k++){
res.pb(attraction[k]);
}
sort(res.begin(),res.end(), greater<>());
int left = d-j+i-1;
left = min(d,(int)res.size());
ll sum = 0;
for(int k = 0; k<left; k++){
sum+=res[k];
}
result = max(result,sum);
}
}
return result;
}
# | 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... |