// . .. ... .... ..... be name khoda ..... .... ... .. . \\
#include<iostream>
#include<algorithm>
#include "wiring.h"
using namespace std;
const long long INF = 1e18;
const int N = 202;
long long dp[N][N];
long long min_total_length(vector<int> red, vector<int> blue)
{
int n = red.size();
int m = blue.size();
fill(dp[0] + 1, dp[0] + m + 1, INF);
for(int i = 1; i <= n; i++)
{
dp[i][0] = INF;
for(int j = 1; j <= m; j++)
dp[i][j] = min(dp[i - 1][j], min(dp[i][j - 1], dp[i - 1][j - 1])) + abs(red[i - 1] - blue[j - 1]);
}
return dp[n][m];
}
Compilation message
wiring.cpp:1:2: warning: multi-line comment [-Wcomment]
// . .. ... .... ..... be name khoda ..... .... ... .. . \\
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2332 KB |
Output is correct |
2 |
Correct |
0 ms |
2332 KB |
Output is correct |
3 |
Correct |
0 ms |
2332 KB |
Output is correct |
4 |
Correct |
0 ms |
2332 KB |
Output is correct |
5 |
Correct |
0 ms |
2332 KB |
Output is correct |
6 |
Correct |
0 ms |
2332 KB |
Output is correct |
7 |
Correct |
0 ms |
2332 KB |
Output is correct |
8 |
Correct |
0 ms |
2332 KB |
Output is correct |
9 |
Correct |
0 ms |
2332 KB |
Output is correct |
10 |
Correct |
0 ms |
2332 KB |
Output is correct |
11 |
Correct |
0 ms |
2332 KB |
Output is correct |
12 |
Correct |
0 ms |
2332 KB |
Output is correct |
13 |
Correct |
0 ms |
2332 KB |
Output is correct |
14 |
Correct |
0 ms |
2332 KB |
Output is correct |
15 |
Correct |
0 ms |
2332 KB |
Output is correct |
16 |
Correct |
0 ms |
2332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2332 KB |
Output is correct |
2 |
Correct |
0 ms |
2332 KB |
Output is correct |
3 |
Runtime error |
36 ms |
3508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2332 KB |
Output is correct |
2 |
Correct |
0 ms |
2332 KB |
Output is correct |
3 |
Runtime error |
63 ms |
3900 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2332 KB |
Output is correct |
2 |
Runtime error |
23 ms |
3900 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2332 KB |
Output is correct |
2 |
Correct |
0 ms |
2332 KB |
Output is correct |
3 |
Correct |
0 ms |
2332 KB |
Output is correct |
4 |
Correct |
0 ms |
2332 KB |
Output is correct |
5 |
Correct |
0 ms |
2332 KB |
Output is correct |
6 |
Correct |
0 ms |
2332 KB |
Output is correct |
7 |
Correct |
0 ms |
2332 KB |
Output is correct |
8 |
Correct |
0 ms |
2332 KB |
Output is correct |
9 |
Correct |
0 ms |
2332 KB |
Output is correct |
10 |
Correct |
0 ms |
2332 KB |
Output is correct |
11 |
Correct |
0 ms |
2332 KB |
Output is correct |
12 |
Correct |
0 ms |
2332 KB |
Output is correct |
13 |
Correct |
0 ms |
2332 KB |
Output is correct |
14 |
Correct |
0 ms |
2332 KB |
Output is correct |
15 |
Correct |
0 ms |
2332 KB |
Output is correct |
16 |
Correct |
0 ms |
2332 KB |
Output is correct |
17 |
Correct |
0 ms |
2332 KB |
Output is correct |
18 |
Correct |
0 ms |
2332 KB |
Output is correct |
19 |
Runtime error |
36 ms |
3508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Halted |
0 ms |
0 KB |
- |