# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064592 | NemanjaSo2005 | Holiday (IOI14_holiday) | C++17 | 5068 ms | 2288 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>
#define ll long long
using namespace std;
const int maxn=1e5+5;
int N,niz[maxn],D;
priority_queue<int> PQ;
ll suma,res=0;
long long int findMaxAttraction(int n, int start, int ddd, int attraction[]) {
N=n;
for(int i=1;i<=N;i++)
niz[i]=attraction[i-1];
D=ddd;
start++;
for(int i=start;i>=1;i--){
suma=0;
while(PQ.size())
PQ.pop();
for(int j=i;j<start;j++){
suma+=niz[j];
PQ.push(-niz[j]);
}
for(int j=start;j<=N;j++){
int d=j-i+min(start-i,j-start);
if(d>=D)
break;
suma+=niz[j];
PQ.push(-niz[j]);
while(PQ.size()+d>D){
suma+=PQ.top();
PQ.pop();
}
res=max(res,suma);
}
}
return res;
}
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... |