제출 #1196343

#제출 시각아이디문제언어결과실행 시간메모리
1196343AMel0nCrocodile's Underground City (IOI11_crocodile)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define endl '\n' #define FOR(N) for(int i = 0; i < N; i++) #define VI vector<int> #define PII pair<int,int> #define F first #define S second #define all(x) (x).begin(), (x).end() ll travel_plan(ll N, ll M, ll R[][2], ll L[], ll K, ll P[]) { vector<vector<PII>> adj(N, vector<PII>()); priority_queue<PII, vector<PII>, greater<>> pq; // second best dist because first best will be blocked, n vector<PII> vis(N, {LLONG_MAX, LLONG_MAX}); // best, second best vector<bool> seen(N, false); FOR(M) { ll a = R[i][0]; ll b = R[i][1]; ll d = L[i]; adj[a].push_back({b, d}); adj[b].push_back({a, d}); } FOR(K){ vis[P[i]] = {0,0}; pq.push({0, P[i]}); } while(pq.size()){ int d = pq.top().F; int n = pq.top().S; pq.pop(); if (seen[n]) continue; seen[n] = true; //cout << d << ' ' << n << ' ' << vis[n].F << ' ' << vis[n].S << endl; for(auto c: adj[n]) { if (vis[c.F].F > d + c.S) { vis[c.F].S = vis[c.F].F; vis[c.F].F = d + c.S; } else if (vis[c.F].S > d + c.S) { vis[c.F].S = d + c.S; } if (vis[c.F].S != LLONG_MAX) pq.push({vis[c.F].S, c.F}); //cout << c.F << ' ' << vis[c.F].F << ' '<< vis[c.F].S << endl; } } cout << vis[0].S; return 0; }

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

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