제출 #793570

#제출 시각아이디문제언어결과실행 시간메모리
793570skittles1412전선 연결 (IOI17_wiring)C++17
7 / 100
110 ms262144 KiB
#include "bits/extc++.h" using namespace std; template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t; ((cerr << " | " << u), ...); cerr << endl; } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__) #else #define dbg(...) #define cerr \ if (false) \ cerr #endif using ll = long long; #define endl "\n" #define long int64_t #define sz(x) int(std::size(x)) ll min_total_length(vector<int> arr_r, vector<int> arr_b) { int n = sz(arr_r), m = sz(arr_b); long dp[n + 1][m + 1]; memset(dp, 0x3f, sizeof(dp)); dp[n][m] = 0; for (int i = n - 1; i >= 0; i--) { for (int j = m - 1; j >= 0; j--) { dp[i][j] = abs(arr_r[i] - arr_b[j]) + min({dp[i + 1][j], dp[i][j + 1], dp[i + 1][j + 1]}); } } dbg(dp[0][0], dp[1][1], dp[2][2], dp[3][3]); return dp[0][0]; }
#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...