# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032221 | tolbi | Holiday (IOI14_holiday) | C++17 | 5050 ms | 1964 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 = start; l >= 0; l--){
priority_queue<ll,vector<ll>,greater<ll>> pq;
ll somma = 0;
for (int i = l; i < start; i++){
pq.push(attraction[i]);
somma+=attraction[i];
}
for (int r = start; r < n; r++){
pq.push(attraction[r]);
somma+=attraction[r];
ll mv = r-l+min(start-l,r-start);
ll 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... |