Submission #68246

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
682462018-08-16 09:46:22mirbek01Wiring (IOI17_wiring)C++17
20 / 100
58 ms10020 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
long long dp[202][202];
long long min_total_length(vector<int> r, vector<int> b) {
long long ans = 0;
int n = (int)(r.size());
int m = (int)(b.size());
if(n <= 200 && m <= 200){
for(int i = 0; i < n; i ++){
for(int j = 0; j < m; j ++){
long long res = abs(r[i] - b[j]), mn = 1e18;
if(i)
mn = dp[i - 1][j];
if(j)
mn = min(mn, dp[i][j - 1]);
if(i && j)
mn = min(mn, dp[i - 1][j - 1]);
if(mn == 1e18)
dp[i][j] = res;
else
dp[i][j] = res + mn;
}
}
return dp[n - 1][m - 1];
}
for(int i = 0; i < n; i ++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...