Submission #1053905

#TimeUsernameProblemLanguageResultExecution timeMemory
1053905aaaaaarroz전선 연결 (IOI17_wiring)C++17
Compilation error
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; long long min_total_length(vector<int>& red, vector<int>& blue) { int n = red.size(); int m = blue.size(); // dp[j] representa la longitud mínima total de cable necesaria para conectar los primeros i puntos rojos y los primeros j puntos azules. vector<long long> dp(m + 1, numeric_limits<long long>::max()); dp[0] = 0; // Procesar puntos rojos uno por uno for (int i = 1; i <= n; ++i) { long long prev_dp_j = dp[0]; dp[0] = numeric_limits<long long>::max(); for (int j = 1; j <= m; ++j) { long long temp = dp[j]; dp[j] = min({dp[j], dp[j - 1], prev_dp_j}) + abs(red[i - 1] - blue[j - 1]); prev_dp_j = temp; } } // El resultado estará en dp[m] return dp[m]; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccTdMame.o: in function `main':
grader.cpp:(.text.startup+0x23a): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status