# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51891 | zetapi | Holiday (IOI14_holiday) | C++14 | 22 ms | 5656 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;
#define pb push_back
#define mp make_pair
#define ll long long
#define itr ::iterator
typedef pair<int,int> pii;
const int MAX=1e5;
vector<int> attractions;
int N;
ll findMaxAttraction(int n, int start, int d,int attraction[])
{
priority_queue<int,vector<int>,greater<int>> pq;
int N=n;
ll sum=0,res=0,left=d;
for(int A=0;A<N;A++)
attractions.pb(attraction[A]);
for(int A=0;A<N;A++)
{
sum+=attractions[A];
pq.push(attractions[A]);
while(pq.size()>left)
{
sum-=pq.top();
pq.pop();
}
res=max(res,sum);
left--;
}
return res;
}
/*signed main()
{
ios_base::sync_with_stdio(false);
cout<<findMaxAttraction()<<"\n";
return 0;
}*/
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... |