이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll min_total_length(vector<int> r, vector<int> b)
{
ll ans = 0;
int n = r.size(), m = b.size();
ll dp[n][m], inf = 1e18;
for(int i = 0; i <= n; i ++)
for(int j = 0; j <= m; j ++)
dp[i][j] = inf;
dp[0][0] = 0;
for(int i = 0; i < n; i ++)
for(int j = 0; j < m; j ++)
dp[i + 1][j + 1] = abs(r[i] - b[j]) + min(min(dp[i][j - 1], dp[i - 1][j]), dp[i - 1][j - 1]);
ans = dp[n][m];
return ans;
}
# | 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... |