| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 730044 | t6twotwo | 모임들 (IOI18_meetings) | C++17 | 473 ms | 196500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1E18;
vector<ll> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
int N = H.size();
int Q = L.size();
if (N <= 5000 && Q <= 5000) {
vector pfs(N, vector<ll>(N + 1));
for (int i = 0; i < N; i++) {
vector<int> mx(N);
mx[i] = H[i];
for (int j = i - 1; j >= 0; j--) {
mx[j] = max(mx[j + 1], H[j]);
}
for (int j = i + 1; j < N; j++) {
mx[j] = max(mx[j - 1], H[j]);
}
for (int j = 0; j < N; j++) {
pfs[i][j + 1] = pfs[i][j] + mx[j];
}
}
vector<ll> ans(Q, inf);
for (int i = 0; i < Q; i++) {
for (int j = L[i]; j <= R[i]; j++) {
ans[i] = min(ans[i], pfs[j][R[i] + 1] - pfs[j][L[i]]);
}
}
return ans;
} else {
vector<int> two;
for (int i = 0; i < N; i++) {
if (H[i] == 2) {
two.push_back(i);
}
}
vector<ll> ans(Q, inf);
for (int i = 0; i < Q; i++) {
int x = lower_bound(two.begin(), two.end(), L[i]) - two.begin();
int y = upper_bound(two.begin(), two.end(), R[i]) - two.begin() - 1;
if (x == two.size() || two[x] > R[i]) {
ans[i] = R[i] - L[i] + 1;
} else {
ans[i] = R[i] - L[i] + 1 + two[y] - two[x] + 1;
}
}
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
