제출 #1112542

#제출 시각아이디문제언어결과실행 시간메모리
1112542SalihSahin전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define int long long using namespace std; #include "wiring.h" const int inf = 1e17; long long min_total_length(vector<int> r, vector<int> b) { int n = r.size(), m = b.size(); vector<int> mndisr(n), mndisb(m); int indb = 0, indr = 0; for(int i = 0; i < n; i++){ while(indb + 1 < m && b[indb+1] < r[i]) indb++; mndisr[i] = min(abs(r[i] - b[indb]), (indb + 1 < m ? abs(r[i] - b[indb+1]) : inf)); } for(int i = 0; i < m; i++){ while(indr + 1 < n && r[indr+1] < b[i]) indr++; mndisb[i] = min(abs(b[i] - r[indr]), (indr + 1 < n ? abs(b[i] - r[indr+1]) : inf)); } vector<vector<int> > dp(n+1, vector<int>(m+1, inf)); dp[0][0] = 0; for(int i = 0; i <= n; i++){ for(int j = 0; j <= m; j++){ if(i < n) dp[i+1][j] = min(dp[i+1][j], dp[i][j] + mndisr[i]); if(j < m) dp[i][j+1] = min(dp[i][j+1], dp[i][j] + mndisb[j]); if(i < n && j < m) dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + abs(r[i] - b[j])); } } return dp[n][m]; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccwE3c6c.o: in function `main':
grader.cpp:(.text.startup+0x22a): 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