# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67278 | theknife2001 | Holiday (IOI14_holiday) | C++17 | 21 ms | 3688 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 <bits/stdc++.h>
using namespace std;
priority_queue < int , vector < int > , greater < int > > pq;
long long int findMaxAttraction(int n, int start, int d, int a[]) {
int x=(d-1)/2;
int ans=0;
for(int i=0;i<x;i++)
{
pq.push(a[i]);
ans+=a[i];
}
int fi,se;
fi=se=-1;
for(int i=x;i<n;i++)
{
if(fi!=-1&&pq.size())
{
fi=pq.top();
pq.pop();
}
if(se!=-1&&pq.size())
{
se=pq.top();
pq.pop();
}
if(a[i]>fi+se)
{
ans+=a[i]-fi-se;
fi=se=-1;
}
}
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... |