# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
410540 | dreezy | Wiring (IOI17_wiring) | C++17 | 1 ms | 288 KiB |
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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int,int>
#define pb push_back
const int maxn = 1e5 + 5;
ll min_total_length(vector<int> r, vector<int> b){
//for each point calculate the closest one
//pair all the closest ones first
ll ans = 0;
int n = r.size();
int m = b.size();
vector<vector<ll>> dp(n+1, vector<ll>(m+1,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(r[i-1] - b[j-1]);
}
}
return dp[n][m];
}
Compilation message (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... |