# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424424 | APROHACK | Holiday (IOI14_holiday) | C++14 | 5036 ms | 2904 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 PB push_back
#define F first
#define S second
using namespace std;
int att[100000];
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
////for(int i = 0 ; i < n ; i++)att[i]=attraction[i];
long long total = 0;
//segTree *st=new segTree(0, 101);
for(int i = 0 ; i <= d-1 ; i++){
long long sum= 0;
priority_queue<long long>pq;
for(int j = start ; j<= start+i ; j++){
sum+=attraction[j];
pq.push(-attraction[j]);
}
long long dist=i;
if(d<=dist)break;
while(pq.size() > d - dist){
sum -= -pq.top();
pq.pop();
}
for(int j = 1 ; j<= (d-i) && (start-(j))>=0; j++){
//st->encender(att[i], true);
pq.push(-attraction[start-j]);
//total=max(total, st->query((d-i)));
dist=i*2+j;
if(d<=dist)break;
while(pq.size() > d - dist){
sum -= -pq.top();
pq.pop();
}
total=max(total, sum);
}
}
return total;
}
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... |