답안 #283667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283667 2020-08-26T05:00:09 Z TMJN 악어의 지하 도시 (IOI11_crocodile) C++17
100 / 100
1414 ms 92288 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

struct edge{
	int to,cost;
};

vector<edge>E[100000];
int C[100000];
long long D[100000];
priority_queue<pair<long long,int>,vector<pair<long long,int>>,greater<pair<long long,int>>>pq;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
	for(int i=0;i<M;i++){
		E[R[i][0]].push_back({R[i][1],L[i]});
		E[R[i][1]].push_back({R[i][0],L[i]});
	}
	for(int i=0;i<K;i++){
		pq.push({0,P[i]});
		pq.push({0,P[i]});
	}
	while(!pq.empty()){
		int x=pq.top().second;
		long long d=pq.top().first;
		pq.pop();
		C[x]++;
		if(C[x]==2){
			D[x]=d;
			for(edge e:E[x]){
				pq.push({d+e.cost,e.to});
			}
		}
	}
	return D[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 3 ms 2816 KB Output is correct
5 Correct 3 ms 2816 KB Output is correct
6 Correct 3 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 3 ms 2816 KB Output is correct
5 Correct 3 ms 2816 KB Output is correct
6 Correct 3 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 6 ms 3328 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 4 ms 2944 KB Output is correct
12 Correct 10 ms 3840 KB Output is correct
13 Correct 8 ms 3836 KB Output is correct
14 Correct 3 ms 2792 KB Output is correct
15 Correct 3 ms 2816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2688 KB Output is correct
2 Correct 2 ms 2688 KB Output is correct
3 Correct 2 ms 2688 KB Output is correct
4 Correct 3 ms 2816 KB Output is correct
5 Correct 3 ms 2816 KB Output is correct
6 Correct 3 ms 2816 KB Output is correct
7 Correct 3 ms 2816 KB Output is correct
8 Correct 3 ms 2816 KB Output is correct
9 Correct 6 ms 3328 KB Output is correct
10 Correct 2 ms 2688 KB Output is correct
11 Correct 4 ms 2944 KB Output is correct
12 Correct 10 ms 3840 KB Output is correct
13 Correct 8 ms 3836 KB Output is correct
14 Correct 3 ms 2792 KB Output is correct
15 Correct 3 ms 2816 KB Output is correct
16 Correct 1321 ms 89168 KB Output is correct
17 Correct 117 ms 14200 KB Output is correct
18 Correct 149 ms 15608 KB Output is correct
19 Correct 1414 ms 92288 KB Output is correct
20 Correct 784 ms 82520 KB Output is correct
21 Correct 58 ms 7800 KB Output is correct
22 Correct 689 ms 47080 KB Output is correct