제출 #1228125

#제출 시각아이디문제언어결과실행 시간메모리
1228125jfioashfn333Cyberland (APIO23_cyberland)C++20
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include <vector> #include <set> #include <utility> #include <limits> #include <cmath> #define int long long #define pb push_back #define eb emplace_back #define pii pair<int,int> #define all(x) x.begin(),x.end() using namespace std; const int I = 1e18; bool u[100005]; vector<pii> g[100005]; int t; void f(int x) { u[x] = 1; if (x == t) return; for (auto p : g[x]) { if (!u[p.first]) f(p.first); } } double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> a) { t = h; for (int i = 0; i < n; i++) g[i].clear(), u[i] = 0; for (int i = 0; i < m; i++) { g[x[i]].eb(y[i], c[i]); g[y[i]].eb(x[i], c[i]); } a[0] = 0; f(0); set<pair<int, int>> q; vector<int> d(n, I); d[0] = 0; q.insert({0, 0}); for (int i = 0; i < n; i++) { if (i && a[i] == 0 && u[i]) { d[i] = 0; q.insert({0, i}); } } while (!q.empty()) { int x = q.begin()->second; q.erase(q.begin()); for (auto p : g[x]) { int y = p.first, w = p.second; if (d[y] > d[x] + w) { q.erase({d[y], y}); d[y] = d[x] + w; q.insert({d[y], y}); } } } if (d[h] == I) return -1; return d[h]; }

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

/usr/bin/ld: /tmp/ccGFDLFm.o: in function `main':
grader.cpp:(.text.startup+0x71e): undefined reference to `solve(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status