제출 #737649

#제출 시각아이디문제언어결과실행 시간메모리
737649Dudziu_전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; int dp[MAXN]={0}, reds[MAXN], blues[MAXN]; int main() { int n,m; cin>>n>>m; for(int i=0; i<n; i++) { cin>>reds[i]; } for(int i=0; i<m; i++) { cin>>blues[i]; } dp[0]=0; dp[1]=abs(reds[0] - blues[0]); if(n>m) { blues[n] = 1e9+1; for(int i=1; i<=n; i++) { dp[i+1] = min(dp[i] + abs(reds[i] - blues[i]), dp[i] + abs(reds[i] - blues[i-1])); } cout<<dp[n]; }else { reds[m] = 1e9+1; for(int i=1; i<=m; i++) { dp[i+1] = min(dp[i] + abs(reds[i] - blues[i]), dp[i] + abs(reds[i-1] - blues[i])); } cout<<dp[m]; } /* 4 5 1 2 3 7 0 4 5 9 10 */ return 0; }

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

/usr/bin/ld: /tmp/cck2RX8G.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0lna0F.o:wiring.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cck2RX8G.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