# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
499743 | dxz05 | Holiday (IOI14_holiday) | C++14 | 5073 ms | 5336 KiB |
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;
typedef long long ll;
long long findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
for (int l = 0; l <= start; l++){
multiset<int> s;
ll sum = 0;
for (int r = l; r < n; r++){
s.insert(attraction[r]);
sum += attraction[r];
if (r < start) continue;
int free = d - (r - l);
free -= min(r - start, start - l);
if (free <= 0) break;
while (s.size() > free){
sum -= *s.begin();
s.erase(s.begin());
}
ans = max(ans, sum);
}
}
return ans;
}
Compilation message (stderr)
# | 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... |