# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064438 | wood | Holiday (IOI14_holiday) | C++17 | 5067 ms | 2148 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 vi vector<int>
#define ll long long
#define pb push_back
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll result = 0;
for (int i = 0; i <= start; ++i) {
ll sum = 0;
priority_queue<int,vi,greater<>> q;
for(int j = i; j<start; j++){ q.push(attraction[j]); sum+=attraction[j];}
for(int j = start; j<n; j++){
int dist = j-i+min(j-start,start-i);
if(d<dist) continue;
q.push(attraction[j]);
sum+=attraction[j];
while(q.size()>d-dist){
sum-=q.top();
q.pop();
}
result = max(result,sum);
}
}
return result;
}
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... |