# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1060819 | Hacv16 | Holiday (IOI14_holiday) | C++17 | 5023 ms | 6368 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
const int MAX = 1e9 + 10;
int findMaxAttraction(int32_t n, int32_t start, int32_t d, int32_t attraction[])
{
int resp = 0;
for(int l = 0; l <= start; l++)
{
int sum = 0;
multiset<int> s;
for(int r = l; r < n; r++)
{
s.insert(-attraction[r]);
sum += attraction[r];
if(r >= start)
{
int fixedCost = min(start - 2 * l + r, 2 * r - start - l);
int visits = d - fixedCost;
while(s.size() > max(0LL, visits))
{
int worst = *(--s.end());
s.erase(s.find(worst));
sum += worst;
}
resp = max(resp, sum);
}
}
}
return resp;
}
// int32_t main()
// {
// int n = 5, start = 2, d = 7;
// int attraction[] = { 10, 2, 20, 30, 1 };
// cout << findMaxAttraction(n, start, d, attraction) << '\n';
// }
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... |