제출 #439849

#제출 시각아이디문제언어결과실행 시간메모리
439849flappybird전선 연결 (IOI17_wiring)C++14
0 / 100
1 ms332 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAX 1010 vector<ll> R, B; ll N, M; ll dp[MAX][MAX]; long long min_total_length(vector<int> r, vector<int> b) { ll i, j; N = r.size(); M = b.size(); R.push_back(0); B.push_back(0); for (i = 0; i < N; i++) R.push_back((ll)r[i]); for (i = 0; i < M; i++) B.push_back((ll)b[i]); for (i = 1; i <= N; i++) { for (j = 1; j <= M; j++) { dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + abs(R[i] - B[j]); } } return dp[N][M]; }
#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...