제출 #1126047

#제출 시각아이디문제언어결과실행 시간메모리
1126047m_bezrutchka꿈 (IOI13_dreaming)C++20
컴파일 에러
0 ms0 KiB
#include "dreaming.h" #include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> pii; const int MAXN = 1e5 + 10; vector<pii> adj[MAXN]; int n, distante; int dist[MAXN]; vector<vector<pii>> chains; bool mrk_1[MAXN], mrk_2[MAXN]; void dfs(int v, int c, bool save) { mrk_1[v] = true; if (save) { mrk_2[v] = true; chains.back().push_back({v, c}); } if (dist[distante] < dist[v]) { distante = v; } for (auto [w, nc]: adj[v]) { if (mrk_1[w]) continue; dist[w] = dist[v] + nc; dfs(w, nc, save); } } void find_chain(int v) { for (int i = 0; i < n; i++) { mrk_1[i] = false; } distante = v; dist[v] = 0; dfs(v, 0, 0); for (int i = 0; i < n; i++) { mrk_1[i] = false; } chains.push_back({}); dist[distante] = 0; dfs(distante, 0, 1); } int travelTime(int N, int M, int L, int A[], int B[], int T[]) { // subtask 1 n = N; for (int i = 0; i < M; i++) { adj[A[i]].push_back({B[i], T[i]}); adj[B[i]].push_back({A[i], T[i]}); } for (int i = 0; i < n; i++) { if (!mrk_2[i]) find_chain(i); } int resp = 0; for (auto &v: chains) { int tot = 0; for (pii &x: v) { tot += x.second; } int l = 0, r = tot; int best = tot; for (pii &x: v) { l += x.second; r -= x.second; best = min(best, max(l, r)); } resp += best; } return resp + L; }

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

/usr/bin/ld: /tmp/ccH8m6Le.o: in function `main':
grader.c:(.text.startup+0xc4): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status