This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "wiring.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> r;
vector<int> b;
ll dp[200][200];
ll solve(int i,int j){
if(i<0 || j<0)return 0;
if(dp[i][j]!=0)return dp[i][j];
dp[i][j] = min(solve(i-1,j),min(solve(i,j-1),solve(i-1,j-1))) + abs(r[i]-b[j]);
return dp[i][j];
}
long long min_total_length(std::vector<int> R, std::vector<int> B) {
r=R,b=B;
return solve(R.size()-1,B.size()-1);
}
# | 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... |