답안 #42304

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

ll d[100005][2];
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:10:1: error: 'll' does not name a type
 ll d[100005][2];
 ^
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:22:3: error: 'd' was not declared in this scope
   d[i][0] = eps;
   ^
crocodile.cpp:30:3: error: 'd' was not declared in this scope
   d[x][0] = 0;
   ^
crocodile.cpp:39:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0 ; j  <adj[u.S].size();j++){
                      ^
crocodile.cpp:41:7: error: 'd' was not declared in this scope
    if(d[u.S][1] + v.F < d[v.S][0]){
       ^
crocodile.cpp:52:9: error: 'd' was not declared in this scope
  return d[0][1];
         ^