답안 #65006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
65006 2018-08-06T12:13:30 Z zetapi 악어의 지하 도시 (IOI11_crocodile) C++14
100 / 100
1234 ms 93732 KB
#include <bits/stdc++.h>
using namespace std;
 
#define pb  push_back
#define mp  make_pair
#define ll  long long
#define itr ::iterator 
 
typedef pair<int,int>  pii;
 
const int MAX=1e6;
const int INF=1e9+9;
 
vector<pii> vec[MAX];
 
ll mark[MAX],dp[MAX],deg[MAX];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{	
	for(int A=0;A<M;A++)
	{
		vec[R[A][0]].pb(mp(R[A][1],L[A]));
		vec[R[A][1]].pb(mp(R[A][0],L[A]));
	}
	priority_queue<pii,vector<pii>,greater<pii>> pq;
	for(int A=0;A<K;A++)
	{
		deg[P[A]]=1;
		pq.push(mp(0,P[A]));
	}
	while(!pq.empty())
	{
		pii cur=pq.top();
		pq.pop();
		deg[cur.second]++;
		if(deg[cur.second]!=2)
			continue;
		dp[cur.second]=cur.first;
		for(auto A:vec[cur.second])
			if(deg[A.first]<2)
				pq.push(mp(cur.first+A.second,A.first));
	}
	return dp[0];
}

/*signed main()
{
	int N,M,K,R[MAX][2],L[MAX],P[MAX];
	cin>>N>>M>>K;
	for(int A=0;A<M;A++)
		cin>>R[A][0]>>R[A][1]>>L[A];
	for(int A=0;A<K;A++)
		cin>>P[A];
	cout<<travel_plan(N,M,R,L,K,P);
	return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23800 KB Output is correct
2 Correct 23 ms 23912 KB Output is correct
3 Correct 23 ms 23912 KB Output is correct
4 Correct 24 ms 23992 KB Output is correct
5 Correct 26 ms 24064 KB Output is correct
6 Correct 23 ms 24064 KB Output is correct
7 Correct 23 ms 24136 KB Output is correct
8 Correct 25 ms 24280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23800 KB Output is correct
2 Correct 23 ms 23912 KB Output is correct
3 Correct 23 ms 23912 KB Output is correct
4 Correct 24 ms 23992 KB Output is correct
5 Correct 26 ms 24064 KB Output is correct
6 Correct 23 ms 24064 KB Output is correct
7 Correct 23 ms 24136 KB Output is correct
8 Correct 25 ms 24280 KB Output is correct
9 Correct 31 ms 24432 KB Output is correct
10 Correct 26 ms 24432 KB Output is correct
11 Correct 30 ms 24432 KB Output is correct
12 Correct 35 ms 24788 KB Output is correct
13 Correct 34 ms 25036 KB Output is correct
14 Correct 27 ms 25036 KB Output is correct
15 Correct 27 ms 25036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 23800 KB Output is correct
2 Correct 23 ms 23912 KB Output is correct
3 Correct 23 ms 23912 KB Output is correct
4 Correct 24 ms 23992 KB Output is correct
5 Correct 26 ms 24064 KB Output is correct
6 Correct 23 ms 24064 KB Output is correct
7 Correct 23 ms 24136 KB Output is correct
8 Correct 25 ms 24280 KB Output is correct
9 Correct 31 ms 24432 KB Output is correct
10 Correct 26 ms 24432 KB Output is correct
11 Correct 30 ms 24432 KB Output is correct
12 Correct 35 ms 24788 KB Output is correct
13 Correct 34 ms 25036 KB Output is correct
14 Correct 27 ms 25036 KB Output is correct
15 Correct 27 ms 25036 KB Output is correct
16 Correct 993 ms 76292 KB Output is correct
17 Correct 123 ms 76292 KB Output is correct
18 Correct 166 ms 76292 KB Output is correct
19 Correct 1234 ms 93732 KB Output is correct
20 Correct 748 ms 93732 KB Output is correct
21 Correct 86 ms 93732 KB Output is correct
22 Correct 741 ms 93732 KB Output is correct