Submission #72932

# Submission time Handle Problem Language Result Execution time Memory
72932 2018-08-27T09:09:03 Z Navick Wiring (IOI17_wiring) C++17
0 / 100
3 ms 468 KB
#include <bits/stdc++.h>
#include "wiring.h"

#define F first
#define S second
#define pii pair <int, int>
#define pb push_back

using namespace std;

typedef long long ll;

const int maxN = 210;
const ll oo = 1e16;

ll dp[maxN][maxN];

long long min_total_length(std::vector<int> r, std::vector<int> b) {
	int n = r.size(), m = b.size();
	
	dp[0][0] = 0;
	for (int j=1; j<=m; j++) dp[0][j] = oo;
	for (int i=1; i<=n; i++) dp[i][0] = oo;

	for (int i=1; i<=n; i++)
		for (int j=1; j<=m; j++)
		{
			ll curr = 0;
			dp[i][j] = oo;

			for (int k=j-1; k>=0; k--)
			{
				curr += abs(r[i - 1] - b[k]);
				dp[i][j] = min(dp[i][j], curr + dp[i - 1][k]);
			}
		}

	return dp[n][m];
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB 3rd lines differ - on the 1st token, expected: '25859', found: '10000000000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 356 KB 3rd lines differ - on the 1st token, expected: '904', found: '10000000000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 392 KB Output is correct
2 Incorrect 3 ms 468 KB 3rd lines differ - on the 1st token, expected: '17703', found: '19052'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 468 KB 3rd lines differ - on the 1st token, expected: '27', found: '30'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB 3rd lines differ - on the 1st token, expected: '25859', found: '10000000000000000'
2 Halted 0 ms 0 KB -