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 for0(i, n) for(int i = 0; i < int(n); ++ i)
using namespace std;
typedef long long ll;
priority_queue<int> pq;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll res = 0, aux = 0;
int cantidad, aux2;
if(!start){
for0(i, n){
aux += (ll) attraction[i];
pq.push(-1 * attraction[i]);
cantidad = d - i;
while((int) pq.size() > cantidad){
aux2 = pq.top();
pq.pop();
aux -= (ll) aux2 * -1LL;
}
res = max(res, aux);
}
}
return res;
}
# | 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... |