# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
775383 | boris_mihov | Holiday (IOI14_holiday) | C++17 | 13 ms | 2636 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 <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <queue>
typedef long long llong;
const int MAXN = 100000 + 10;
const int INF = 1e9;
llong sum = 0;
std::priority_queue <llong> pq;
llong findMaxAttraction(int n, int start, int d, int a[])
{
llong ans = 0;
for (int i = 0 ; i < std::min(d, n) ; ++i)
{
sum += a[i];
pq.push(-a[i]);
while (pq.size() > d - i)
{
sum += pq.top();
pq.pop();
}
ans = std::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... |