# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032219 | tolbi | Holiday (IOI14_holiday) | C++17 | 5018 ms | 2436 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;
typedef long long ll;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
for (int l = 0; l < n; l++){
priority_queue<int,vector<int>,greater<int>> pq;
ll somma = 0;
for (int i = l; i < start; i++){
pq.push(attraction[i]);
somma+=attraction[i];
}
for (int r = l; r < n; r++){
pq.push(attraction[r]);
somma+=attraction[r];
int mv;
if (l<=start && r>=start){
mv = r-l+min(start-l,r-start);
}
else mv=max(abs(start-l),abs(start-r));
int kal = d-mv;
while (pq.size()>kal){
somma-=pq.top();
pq.pop();
}
ans=max(ans,somma);
}
}
return ans;
}
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... |