# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
69749 | E869120 | Holiday (IOI14_holiday) | C++14 | 5075 ms | 4600 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 <queue>
#include <algorithm>
#include <functional>
#include <vector>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long>> Q;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
long long maxn = 0;
for (int i = 0; i <= start; i++) {
while (!Q.empty()) Q.pop();
long long val = 0;
for (int j = i; j < n; j++) {
val += attraction[j]; Q.push(attraction[j]);
if (j >= start) {
long long cost = (j - i) + min(j - start, start - i);
while (!Q.empty() && (int)Q.size() > d - cost) { val -= Q.top(); Q.pop(); }
maxn = max(maxn, val);
}
}
}
return maxn;
}
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... |