제출 #1083539

#제출 시각아이디문제언어결과실행 시간메모리
1083539jay22친구 (IOI14_friend)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> const int LEN = 100'000; int N, w[LEN], dp[LEN][2], host[LEN], protocol[LEN]; int main() { std::cin >> N; for (int i = 0; i < N; ++i) std::cin >> w[i]; for (int i = 1; i < N; ++i) std::cin >> host[i] >> protocol[i]; for (int i = N - 1; i; --i) { if (protocol[i] == 0) { dp[host[i]][1] += dp[i][0]; dp[host[i]][0] += std::max(dp[i][0], dp[i][1] + w[i]); } if (protocol[i] == 1) { dp[host[i]][0] += dp[i][0]; dp[host[i]][1] += std::max(dp[i][0], dp[i][1] + w[i]); } if (protocol[i] == 2) { dp[host[i]][0] += dp[i][0]; dp[host[i]][1] += std::max(dp[i][0], dp[i][1]); w[host[i]] = std::max(w[host[i]], w[i]); } } std::cout << std::max(dp[0][0], dp[0][1] + w[0]); }

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

/usr/bin/ld: /tmp/cc3odwqw.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoBEljx.o:friend.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc3odwqw.o:(.bss+0x0): multiple definition of `protocol'; /tmp/ccoBEljx.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/cc3odwqw.o:(.bss+0x61aa0): multiple definition of `host'; /tmp/ccoBEljx.o:(.bss+0x61a80): first defined here
/usr/bin/ld: /tmp/cc3odwqw.o: in function `main':
grader.cpp:(.text.startup+0xdd): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status