# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296255 | arayi | Holiday (IOI14_holiday) | C++17 | 5052 ms | 3236 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 <bits/stdc++.h>
#include "holiday.h"
#define lli long long int
using namespace std;
long long int findMaxAttraction(int n, int st, int d, int a[])
{
lli pat = 0;
for(int l = 0; l <= st; ++l)
{
priority_queue<lli, vector<lli>, greater<lli> > q;
lli sum = 0;
for (int r = l; r < n; r++)
{
sum += a[r];
q.push(a[r]);
int sm = min(abs(r - st), abs(l - st)) + r - l;
sm = d - sm;
if(sm < 0) continue;
while(q.size() > sm) sum -= q.top(), q.pop();
pat = max(pat, sum);
}
}
return pat;
}
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... |