# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
430051 | Rouge_Hugo | Holiday (IOI14_holiday) | C++14 | 37 ms | 5556 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<bits/stdc++.h>
#include"holiday.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
multiset<ll>s;
long long int findMaxAttraction(int n, int start, int d, int a[])
{
ll mx=0;ll ans=0;
if(d>=1)
mx=a[start];
s.insert(a[0]);
ans+=a[0];int r=d;
for(int i=1;i<n;i++)
{
r--;
if(r<=0)
break;
s.insert(a[i]);
ans+=a[i];
if(r<=0)
break;
while(s.size()>r)
{
ans-=*s.begin();
s.erase(s.begin());
}
mx=max(mx,ans);
}
return mx;
}
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... |