# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
389182 | MilosMilutinovic | Wiring (IOI17_wiring) | C++14 | 30 ms | 1856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "wiring.h"
using namespace std;
long long min_total_length(vector<int> a, vector<int> b) {
int n = (int) a.size(), m = (int) b.size();
if (n <= 200 && m <= 200) {
const long long inf = 1e17;
vector<vector<long long>> dp(n + 1, vector<long long>(m + 1, inf));
dp[0][0] = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
dp[i][j] = min({dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]}) + abs(a[i - 1] - b[j - 1]);
}
}
return dp[n][m];
}
if (a[n - 1] < b[0]) {
long long ans = 0;
for (int i = 0; i < n; i++) ans += (a[n - 1] - a[i]);
for (int i = 0; i < m; i++) ans += (b[i] - b[0]);
ans += (long long) (b[0] - a[n - 1]) * max(n, m);
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... |