# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007407 | NintsiChkhaidze | Holiday (IOI14_holiday) | C++17 | 5083 ms | 5468 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>
#define ll long long
using namespace std;
const int N = 2e5 + 3;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
for (int L = 0; L <= start; L++){
for (int R = start; R < n; R++){
multiset <int> st; ll sum = 0;
for (int i = L; i <= R; i++)
st.insert(attraction[i]),sum += attraction[i];
int cnt = d - (R - L) - min(start - L,R - start);
if (cnt <= 0) continue;
while (st.size() > cnt){
sum -= *st.begin();
st.erase(st.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... |