답안 #494321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494321 2021-12-15T06:06:12 Z keertan 악어의 지하 도시 (IOI11_crocodile) C++17
컴파일 오류
0 ms 0 KB
#include "crocodile.h"
#include<bits/stdc++.h>
using namespace std;
#define int  int64_t
#define all(x) x.begin(),x.end()
#define all1(x) x.rbegin(),x.rend()
#define sz(x) (int)(x.size())
const int N=1e4+5,N1=1e18,mod=1e9+7;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
  int n,m,k;
  n=N;
  m=M;
  k=K;
 
  using gh=pair<int,int>;
  vector<pair<int,int>> adj[n];
  for (int i=0,u,v,w;i<m;i++){
    u=R[i][0],v=R[i][1],w=L[i];
    adj[u].emplace_back(v,w);
    adj[v].emplace_back(u,w);
  }
  vector<gh> dis(n,{N1,N1});
  priority_queue<gh,vector<gh>,greater<gh>> q;
  vector<bool> vis(n);
  for (int i=0,x;i<k;i++){
    x=P[i];
    q.emplace(0,x);
    dis[x]={0,0};
  }
  while(!q.empty()){
    int u,dis1;
    tie(dis1,u)=q.top();
    q.pop();
    //cerr<<u<<" "<<dis1<<"\n";
    if (vis[u]){continue;}
    vis[u]=1;
    for (const gh &it:adj[u]){
      int cur=dis1+it.second;
      if (dis[it.first].first>=cur){
        dis[it.first].second=dis[it.first].first;
        dis[it.first].first=cur;
      }
      else if (cur<dis[it.first].second){
        dis[it.first].second=cur;
      }
      if (dis[it.first].first!=N1 && dis[it.first].second!=N1 && !vis[it.first]){
        q.emplace(dis[it.first].second,it.first);
      }
    }
  }
  return dis[0].second;
}

Compilation message

/usr/bin/ld: /tmp/cccw7jK3.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