제출 #283869

#제출 시각아이디문제언어결과실행 시간메모리
283869mohammad전선 연결 (IOI17_wiring)C++14
7 / 100
39 ms6392 KiB
#include "wiring.h" #include<bits/stdc++.h> using namespace std; #define endl "\n" // #define int long long typedef long long ll ; const ll ooo = 1e14 ; const ll oo = 2e9 ; const double PI = acos(-1) ; const ll M = 1e9 + 7 ; const int N = 10000010 ; ll dp[222][222]; ll min_total_length(vector<int> r, vector<int> b) { ll nr = r.size() , nb = b.size(); for(int i = 0 ; i < nr; ++i) for(int j = 0 ; j < nb; ++j){ dp[i][j] = 0; if(i && j){ dp[i][j] = min(dp[i - 1][j - 1] , min(dp[i][j - 1] , dp[i - 1][j] )); }else if(i) dp[i][j] = dp[i - 1][j]; else if(j) dp[i][j] = dp[i][j - 1]; // cout << dp[i][j] << ' ' << b[j] << ' ' << r[i] << endl; dp[i][j] += abs(b[j] - r[i]); } return dp[nr- 1][nb - 1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...