| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1033350 | onbert | 휴가 (IOI14_holiday) | C++17 | 5043 ms | 3244 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "holiday.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 1e5 + 5;
int n, a[maxn];
int solve(int s, int d) {
int ans = 0, curans = 0;
priority_queue<int, vector<int>, greater<int>> pq;
for (int i=s;i<=n;i++) {
pq.push(a[i]), curans += a[i];
while (pq.size() > 0 && i-s + pq.size() > d) {
curans -= pq.top();
pq.pop();
}
ans = max(curans, ans);
}
// cout << s << " " << d << " " << ans << endl;
return ans;
}
int findMaxAttraction(int32_t N, int32_t S, int32_t d, int32_t A[]) {
n = N, S++;
for (int i=1;i<=n;i++) a[i] = A[i-1];
if (S==1) return solve(1, d);
int ans = 0;
for (int i=S, D=d; i>=1; i--, D--) ans = max(solve(i, D), ans);
reverse(a+1, a+n+1); S = n+1-S;
for (int i=S, D=d; i>=1; i--, D--) ans = max(solve(i, D), ans);
return ans;
}컴파일 시 표준 에러 (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... | ||||
