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 <queue>
#include <vector>
#include "holiday.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
long long findMaxAttraction(int n, int start, int d, int attraction[])
{
long long ans=0;
if (start==0)
{
priority_queue<int>pq;
for (int j=0;j<min(n,d);j++)
{
vector<int>F;
long long z=attraction[j];
int x=d-1-j;
for (int k=0;k<j&&x>0;k++)
{
x--;
z+=pq.top();
F.push_back(pq.top());
pq.pop();
}
ans=max(ans,z);
pq.push(attraction[j]);
for (auto i:F)
pq.push(i);
}
return ans;
}
// for (int i=0;i<n;i++)
// {
// }
return 0;
}
# | 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... |