# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582342 | wdjpng | Holiday (IOI14_holiday) | C++17 | 11 ms | 1492 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 int long long
#define rep(i,n) for(int i = 0; i < ((int) n); i++)
#define all(a) a.begin(), a.end()
using namespace std;
int findMaxAttraction(signed n, signed start, signed d, signed attraction[]) {
vector<int>x(n);
rep(i,n) x[i] = attraction[i];
if(n<=20)
{
int maxx=0;
rep(i,n)
{
for(int j = i; j < n; j++)
{
priority_queue<int>pq;
for(int k = i; k <= j; k++)
{
pq.push(x[k]);
}
int sum = 0;
rep(i,(d-abs(start-i)-abs(i-j))/2) if(pq.size()){sum+=pq.top(); pq.pop();}
maxx=max(sum,maxx);
}
}
return maxx;
}
}
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... |