# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1045294 | ArthuroWich | Holiday (IOI14_holiday) | C++17 | 5089 ms | 5480 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;
#define int long long int
int findMaxAttraction(int32_t n, int32_t st, int32_t d, int32_t at[]) {
int ans = 0;
for (int l = st; l >= 0; l--) {
int co = 0, col = 0;
multiset<int> s;
if (st-l > d) {
break;
}
for (int i = st; i >= l; i--) {
co += at[i];
s.insert(at[i]);
}
if (s.size() <= d-(st-l)) {
ans = max(ans, co);
}
for (int r = st+1; r < n; r++) {
if (st-l+r-st+min(r-st,st-l) > d) {
break;
}
int k = d-(st-l+r-st+min(r-st,st-l));
s.insert(at[r]);
co += at[r];
while(s.size() > k) {
co -= *s.begin();
s.erase(s.begin());
}
ans = max(ans, co);
}
}
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... |