# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316409 | juggernaut | Holiday (IOI14_holiday) | C++14 | 5065 ms | 1996 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>
#ifdef EVAL
#else
#include"grader.cpp"
#endif
using namespace std;
typedef long long ll;
ll findMaxAttraction(int n,int start,int d,int attraction[]){
ll rs=0;
for(int i=0;i<=start;i++){
priority_queue<int>q;
ll sum=0;
for(int j=i;j<n;j++){
q.push(-attraction[j]);
sum+=(ll)attraction[j];
int rem=d-min((start-i)+(j-i),(j-start)+(j-i));
if(rem<1||j<start)continue;
while(!q.empty()&&q.size()>rem){
sum+=(ll)q.top();
q.pop();
}
rs=max(rs,sum);
}
}
return rs;
}
/*
5 2 7
10 2 20 30 1
*/
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... |