# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
298062 | mieszko11b | Holiday (IOI14_holiday) | C++14 | 5044 ms | 5760 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;
using ll = long long;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll res = 0;
vector<int> a(n);
for(int i = 0 ; i < n ; i++)
a[i] = attraction[i];
for(int t = 0 ; t < 2 ; t++) {
for(int i = start ; i >= 0 ; i--) {
ll sum = 0;
multiset<int> S;
int d2 = d - (start - i);
for(int j = i ; j < n ; j++) {
//~ cout << i << " " << j << endl;
S.insert(a[j]);
sum += a[j];
while(S.size() > d2 - (j - i)) {
auto it = S.begin();
sum -= *it;
S.erase(it);
}
res = max(res, sum);
}
}
//~ reverse(a.begin(), a.end());
//~ start = n - start - 1;
}
return res;
}
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... |