# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424401 | dreezy | 휴가 (IOI14_holiday) | C++17 | 17 ms | 2196 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 <bits/stdc++.h>
#include"holiday.h"
using namespace std;
#define ll long long
/***********************/
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
ll ans = 0;
//spend right days travelling
//visit day - right cities
priority_queue<int, vector<int>, greater<int>> pq;
ll cursum = 0;
for(int right = 0; right <n; right++){
cursum += attraction[right];
pq.push(attraction[right]);
while(pq.size() > d - right){
cursum -= pq.top();
pq.pop();
}
ans = max(cursum, ans);
}
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... |