# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
58634 | aome | 휴가 (IOI14_holiday) | C++17 | 5096 ms | 1584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "holiday.h"
#include <bits/stdc++.h>
using namespace std;
long long int findMaxAttraction(int n, int start, int d, int attraction[]) {
for (int i = 0; i < n; ++i) assert(attraction[i] >= 0);
int cur = 0;
long long res = 0;
long long sum = 0;
priority_queue< int, vector<int>, greater<int> > pq;
for (int i = start; i >= 0; --i) {
cur = d - (start - i);
sum = 0;
for (int j = i; j < n; ++j) {
sum += attraction[j], pq.push(attraction[j]);
while (pq.size() && pq.size() > cur) {
sum -= pq.top(), pq.pop();
}
res = max(res, sum);
cur--;
}
while (pq.size()) pq.pop();
}
if (start) {
for (int i = start; i < n; ++i) {
cur = d - (i - start);
sum = 0;
for (int j = i; j >= 0; --j) {
sum += attraction[j], pq.push(attraction[j]);
while (pq.size() && pq.size() > cur) {
sum -= pq.top(), pq.pop();
}
res = max(res, sum);
cur--;
}
while (pq.size()) pq.pop();
}
}
return res;
}
컴파일 시 표준 에러 (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... |