답안 #951009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951009 2024-03-21T04:12:18 Z efishel 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;

const ll MAXN = 1E5+16;
vector <pair <ll, ll> > adj[MAXN];

ll travel_plan (int _n, int _m, vector <vector <int> > _r, vector <int> _l, int _k, vector <int> _p) {
    ll n = _n, m = _m, k = _k;
    for (ll i = 0; i < m; i++) {
        ll u = _r[i][0], v = _r[i][1];
        ll w = _l[i];
        adj[u].push_back({ v, w });
        adj[v].push_back({ u, w });
    }
    priority_queue <pair <ll, ll> > pq;
    vll cvis(n, 0);
    vector <bool> vis(n, false);
    vll dis(n);
    for (auto u : _p) {
        cvis[u] = 1;
        dis[u] = 0;
        pq.push({ -dis[u], u });
    }
    while (pq.size()) {
        auto [disU, u] = pq.top(); disU = -disU; pq.pop();
        cvis[u]++;
        if (cvis[u] != 2) continue;
        dis[u] = disU;
        for (auto [v, w] : adj[u]) {
            pq.push({ -(dis[u]+w), v });
        }
    }
    return dis[0];
}

Compilation message

crocodile.cpp: In function 'll travel_plan(int, int, std::vector<std::vector<int> >, std::vector<int>, int, std::vector<int>)':
crocodile.cpp:11:24: warning: unused variable 'k' [-Wunused-variable]
   11 |     ll n = _n, m = _m, k = _k;
      |                        ^
/usr/bin/ld: /tmp/ccNgBivk.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