제출 #891286

#제출 시각아이디문제언어결과실행 시간메모리
891286Erfan1386Y경주 (Race) (IOI11_race)C++17
컴파일 에러
0 ms0 KiB
#include "race.h" #include <bits/stdc++.h> #define file_io freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout); #define fast_io ios::sync_with_stdio(false);cin.tie(0); #define what(x) cerr << #x << " is " << x << '\n'; #define kill(x) {cout << x << '\n'; return 0;} #define all(x) (x).begin(), (x).end() #define pii pair<int, int> #define pb push_back #define ll long long #define F first #define S second const ll inf = 1e16, mod = 1e9 + 7, delta = 1e9 + 9, SQ = 450, P = 6065621; using namespace std; #define int ll const ll N = 2e5 + 10, LG = 20; ll n, k, ans = inf; vector<pii> adj[N]; set<pii> s[N]; void add (int v, int u, int w) { for (auto x: s[u]) { auto y = *s[v].lower_bound(pii(k - x.F - w, 0)); if (y.F != k - x.F - w) continue; ans = min(ans, x.S + y.S); } for (auto x: s[u]) { s[v].insert({x.F + w, x.S + 1}); } s[u].clear(); } void dfs (int v, int p = -1) { for (auto u: adj[v]) { if (u.F - p) { dfs(u.F, v); if (s[v].size() < s[u.F].size()) s[v].swap(s[u.F]); add(v, u.F, u.S); } } } int best_path(int N, int K, int H[][2], int L[]) { fast_io; n = N, k = K; for (int i = 0; i <= n; i++) { s[i].insert({inf, 0}); s[i].insert({0, 0}); } for (int i = 0; i < n - 1; i++) { int u, v, w; u = H[i][0], v = H[i][1]; w = L[i]; adj[u].pb({v, w}); adj[v].pb({u, w}); } dfs(0); // for (auto u: s[0]) // cout << u.F << ' ' << u.S << '\n'; if (ans >= inf) return -1; return ans + 1; }

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

/usr/bin/ld: /tmp/ccjGGpU5.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status