# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424428 | APROHACK | Holiday (IOI14_holiday) | C++14 | 5067 ms | 3028 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 rta = 0;
for(int left = start ; left>= 0 ; left++){
long long cur = 0;
priority_queue<long long>pq;
for(int i = left ; i < start ; i++){
pq.push(-attraction[i]);
cur+=attraction[i];
}
for(int r = start ; r< n ; r++){
cur+=attraction[r];
pq.push(-attraction[r]);
int dist = r - left + min(start - left, r - start);
if(d - dist <= 0) break;
while(pq.size() > d - dist){
cur -= pq.top();
pq.pop();
}
rta = max(cur, rta);
}
}
return rta;
}
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... |