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>
#ifndef ARTHUR_LOCAL
#include "holiday.h"
#endif
using namespace std;
using ll=long long;
ll findMaxAttraction(int n, int sta, int d, int A[])
{
int ans=0;
priority_queue<int> active;
int active_sum=0;
for(int i=0; i<n; i++)
{
active.push(-A[i]);
active_sum += A[i];
while(int(active.size()) + i > d && !active.empty())
{
active_sum += active.top();
active.pop();
}
if(int(active.size()) + i <= d) ans = max(ans,active_sum);
}
return ans;
}
# | 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... |