답안 #29360

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
29360 2017-07-19T07:04:00 Z aybala 악어의 지하 도시 (IOI11_crocodile) C++11
0 / 100
396 ms 123848 KB
#include "crocodile.h"
#include<bits/stdc++.h>
#define fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
#define fr front
#define emp empty
#define pq priority_queue
#define pll pair<long,long>
using namespace std;

vector< pii >v[100005];
int ex[100005];
pq< pii >q;
int dis[100005];

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){	
	int i,j,k;
	fori(i,0,N){
		v[R[i][0]].pb(mp(L[i],R[i][1]));
		v[R[i][1]].pb(mp(L[i],R[i][0]));	
		dis[i]=-1;
	}
	
	fori(i,0,K){
		ex[P[i]]=1;
		dis[P[i]]=0;	
		q.push(mp(0,P[i]));
	}
	
	while(!q.empty()){
		int t=q.top().se;
		int s=v[t].size();
		q.pop();
		fori(i,0,s){
			if(ex[v[t][i].se]){
				if(dis[v[t][i].se]>dis[t]+v[t][i].fi || dis[v[t][i].se]==-1){
					dis[v[t][i].se]=dis[t]+v[t][i].fi;
					q.push(mp(-dis[v[t][i].se],v[t][i].se));
				}
			}
			ex[v[t][i].se]++;
		}
	}
	return dis[0];
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:23:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k;
        ^
crocodile.cpp:23:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k;
          ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 122528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 122528 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 396 ms 123848 KB Output isn't correct
2 Halted 0 ms 0 KB -