제출 #298781

#제출 시각아이디문제언어결과실행 시간메모리
298781ChrisT전선 연결 (IOI17_wiring)C++17
7 / 100
252 ms262148 KiB
#include <bits/stdc++.h> #include "wiring.h" using namespace std; const int MN = 2e5 + 3; long long min_total_length (vector<int> r, vector<int> b) { vector<vector<long long>> dp((int)r.size() + 1, vector<long long>((int)b.size() + 1,1e18)); dp[0][0] = 0; sort(r.begin(),r.end()); sort(b.begin(),b.end()); for (int i = 1; i <= (int)r.size(); i++) { for (int j = 1; j <= (int)b.size(); j++) { dp[i][j] = abs(r[i-1] - b[j-1]) + min({dp[i-1][j-1],dp[i-1][j],dp[i][j-1]}); } } return dp[(int)r.size()][(int)b.size()]; }
#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...