답안 #42303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42303 2018-02-25T20:36:56 Z wzy 악어의 지하 도시 (IOI11_crocodile) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
#define F first
#define S second
#define pb push_back
#define int long long
#define pii pair<int,int>
#define eps (int) 1e9

int d[100005][2],n,m , k;
vector<pii> adj[100005];
bool cc[100005] , vis[100005];



int travel_plan(int n, int m, int R[][2], int l[], int k, int p[]){
	for(int i = 0 ; i <m  ;i++){
		adj[R[i][0]].pb(pii(l[i],R[i][1]));
		adj[R[i][1]].pb(pii(l[i],R[i][0]));
	}
	for(int i = 0 ; i <n;i++){
		d[i][0] = eps;
		d[i][1] = eps;
	}
	priority_queue<pii , vector<pii> , greater<pii> > pq;
	for(int i = 0 ; i < k ;i++){
		int x;
		x = p[i];
		cc[x] = true;
		d[x][0] = 0;
		d[x][1] = 0;
		pq.push(pii(0,x));
	}
	while(!pq.empty()){
		pii u = pq.top();
		pq.pop();
		if(vis[u.S]) continue;
		vis[u.S] = true;
		for(int j = 0 ; j  <adj[u.S].size();j++){
			pii v = adj[u.S][j];
			if(d[u.S][1] + v.F < d[v.S][0]){
				swap(d[v.S][0] , d[v.S][1]);
				d[v.S][0] = d[u.S][1] + v.F;
				pq.push(pii(d[v.S][1],v.S));
			}
			else if(d[u.S][1] + v.F < d[v.S][1]){
				d[v.S][1] = d[u.S][1] + v.F;
				pq.push(pii(d[v.S][1] , v.S));
			}
		}
	}
	return d[0][1];
}

Compilation message

crocodile.cpp: In function 'long long int travel_plan(long long int, long long int, long long int (*)[2], long long int*, long long int, long long int*)':
crocodile.cpp:40:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0 ; j  <adj[u.S].size();j++){
                      ^
/tmp/ccI5ZhQ2.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status