제출 #979468

#제출 시각아이디문제언어결과실행 시간메모리
979468HappyCapybara사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include<bits/stdc++.h> #define int long long using namespace std; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr){ vector<vector<pair<int,int>>> g(N); for (int i=0; i<M; i++){ g[x[i]].push_back({y[i], c[i]}); g[y[i]].push_back({x[i], c[i]}); } int dist = -1; vector<bool> seen(N, false); priority_queue<pair<int,int>> pq; pq.push({0, 0}); while (!pq.empty()){ int d = -pq.top().first; int cur = pq.top().second; pq.pop(); if (cur == H){ dist = d; break; } if (seen[cur]) continue; seen[cur] = true; for (pair<int,int> next : g[cur]) pq.push({-(d+next.second), next.first}); } unordered_set<int> s; seen.clear(); seen.resize(N, false); queue<int> q; q.push(0); while (!q.empty()){ int cur = q.front(); q.pop(); if (cur == H) continue; if (seen[cur]) continue; seen[cur] = true; if (arr[cur] == 0) s.insert(cur); for (pair<int,int> next : g[cur]) q.push(next.first); } seen.clear(); seen.resize(N, false); while (!pq.empty()) pq.pop(); pq.push({0, H}); while (!pq.empty()){ int d = -pq.top().first; int cur = pq.top().second; pq.pop(); if (s.find(cur) != s.end()){ if (d < dist) return (double) d; else break; } if (seen[cur]) continue; seen[cur] = true; for (pair<int,int> next : g[cur]) pq.push({-(d+next.second), next.first}); } return (double) dist; }

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

/usr/bin/ld: /tmp/ccyiUxIb.o: in function `main':
grader.cpp:(.text.startup+0x696): 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