답안 #402500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
402500 2021-05-11T19:25:28 Z Jasiekstrz 악어의 지하 도시 (IOI11_crocodile) C++17
100 / 100
861 ms 92948 KB
#include "crocodile.h"
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int NN=1e5;
int vis[NN+10];
long long d[NN+10];
priority_queue<pair<int,int>> pq;
vector<pair<long long,int>> e[NN+10];
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]].emplace_back(R[i][1],L[i]);
		e[R[i][1]].emplace_back(R[i][0],L[i]);
	}
	for(int i=0;i<K;i++)
	{
		vis[P[i]]=1;
		pq.push({0,P[i]});
	}
	while(!pq.empty())
	{
		int x=pq.top().se;
		long long c=-pq.top().fi;
		pq.pop();
		vis[x]++;
		if(vis[x]!=2)
			continue;
		//cerr<<x<<" "<<c<<"\n";
		d[x]=c;
		for(auto v:e[x])
		{
			if(vis[v.fi]<2)
				pq.push({-c-v.se,v.fi});
		}
	}
	return d[0];
}

# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 3 ms 2636 KB Output is correct
3 Correct 4 ms 2656 KB Output is correct
4 Correct 4 ms 2664 KB Output is correct
5 Correct 3 ms 2764 KB Output is correct
6 Correct 4 ms 2636 KB Output is correct
7 Correct 4 ms 2764 KB Output is correct
8 Correct 4 ms 2764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 3 ms 2636 KB Output is correct
3 Correct 4 ms 2656 KB Output is correct
4 Correct 4 ms 2664 KB Output is correct
5 Correct 3 ms 2764 KB Output is correct
6 Correct 4 ms 2636 KB Output is correct
7 Correct 4 ms 2764 KB Output is correct
8 Correct 4 ms 2764 KB Output is correct
9 Correct 6 ms 3148 KB Output is correct
10 Correct 4 ms 2636 KB Output is correct
11 Correct 5 ms 2764 KB Output is correct
12 Correct 10 ms 3556 KB Output is correct
13 Correct 8 ms 3660 KB Output is correct
14 Correct 3 ms 2656 KB Output is correct
15 Correct 4 ms 2792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 3 ms 2636 KB Output is correct
3 Correct 4 ms 2656 KB Output is correct
4 Correct 4 ms 2664 KB Output is correct
5 Correct 3 ms 2764 KB Output is correct
6 Correct 4 ms 2636 KB Output is correct
7 Correct 4 ms 2764 KB Output is correct
8 Correct 4 ms 2764 KB Output is correct
9 Correct 6 ms 3148 KB Output is correct
10 Correct 4 ms 2636 KB Output is correct
11 Correct 5 ms 2764 KB Output is correct
12 Correct 10 ms 3556 KB Output is correct
13 Correct 8 ms 3660 KB Output is correct
14 Correct 3 ms 2656 KB Output is correct
15 Correct 4 ms 2792 KB Output is correct
16 Correct 724 ms 88944 KB Output is correct
17 Correct 83 ms 17172 KB Output is correct
18 Correct 113 ms 19672 KB Output is correct
19 Correct 861 ms 92948 KB Output is correct
20 Correct 473 ms 76348 KB Output is correct
21 Correct 59 ms 9540 KB Output is correct
22 Correct 506 ms 64172 KB Output is correct