답안 #308961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308961 2020-10-02T12:21:38 Z tengiz05 악어의 지하 도시 (IOI11_crocodile) C++17
89 / 100
968 ms 62572 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9+7;
const int NN = 2e5+5;
vector<pair<int, int>> edges[NN];
multiset<int> dist[NN];
int travel_plan(int n, int m, int R[][2], int L[], int k, int P[]){
	for(int i=0;i<m;i++){
		edges[R[i][0]].push_back({R[i][1], L[i]});
		edges[R[i][1]].push_back({R[i][0], L[i]});
	}
	priority_queue<pair<int, int>> q;
	for(int i=0;i<k;i++){
		dist[P[i]].insert(0);
		dist[P[i]].insert(0);
		
		q.push({0, P[i]});
	}for(int i=0;i<n;i++){
		if(dist[i].empty()){
			dist[i].insert(inf);
			dist[i].insert(inf);
		}
	}
	while(!q.empty()){
		auto pp = q.top();q.pop();
		int d = -pp.first;
		int u = pp.second;
		auto dd = dist[u].begin();dd++;
		int D = *dd;
		if(D < d)continue;
		for(auto X : edges[u]){
			int v = X.first;
			int cost = X.second;
			auto ss = dist[v].begin();ss++;
			if(D+cost >= *ss)continue;
			dist[v].erase(dist[v].find(*ss));
			dist[v].insert(D + cost);
			auto s1 = dist[v].begin();s1++;
			if(*s1 != inf){
				q.push({-(*s1), v});
			}
		}
	}
	auto ans1 = dist[0].begin();ans1++;
	int ans = *ans1;
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14464 KB Output is correct
2 Correct 11 ms 14460 KB Output is correct
3 Correct 11 ms 14464 KB Output is correct
4 Correct 10 ms 14592 KB Output is correct
5 Correct 10 ms 14592 KB Output is correct
6 Correct 10 ms 14464 KB Output is correct
7 Correct 10 ms 14592 KB Output is correct
8 Correct 10 ms 14592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14464 KB Output is correct
2 Correct 11 ms 14460 KB Output is correct
3 Correct 11 ms 14464 KB Output is correct
4 Correct 10 ms 14592 KB Output is correct
5 Correct 10 ms 14592 KB Output is correct
6 Correct 10 ms 14464 KB Output is correct
7 Correct 10 ms 14592 KB Output is correct
8 Correct 10 ms 14592 KB Output is correct
9 Correct 11 ms 14592 KB Output is correct
10 Correct 10 ms 14464 KB Output is correct
11 Correct 11 ms 14464 KB Output is correct
12 Correct 14 ms 14720 KB Output is correct
13 Correct 13 ms 14848 KB Output is correct
14 Correct 11 ms 14464 KB Output is correct
15 Correct 10 ms 14464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 14464 KB Output is correct
2 Correct 11 ms 14460 KB Output is correct
3 Correct 11 ms 14464 KB Output is correct
4 Correct 10 ms 14592 KB Output is correct
5 Correct 10 ms 14592 KB Output is correct
6 Correct 10 ms 14464 KB Output is correct
7 Correct 10 ms 14592 KB Output is correct
8 Correct 10 ms 14592 KB Output is correct
9 Correct 11 ms 14592 KB Output is correct
10 Correct 10 ms 14464 KB Output is correct
11 Correct 11 ms 14464 KB Output is correct
12 Correct 14 ms 14720 KB Output is correct
13 Correct 13 ms 14848 KB Output is correct
14 Correct 11 ms 14464 KB Output is correct
15 Correct 10 ms 14464 KB Output is correct
16 Correct 735 ms 53616 KB Output is correct
17 Correct 134 ms 30892 KB Output is correct
18 Correct 164 ms 31564 KB Output is correct
19 Correct 968 ms 62572 KB Output is correct
20 Correct 363 ms 48376 KB Output is correct
21 Correct 69 ms 20728 KB Output is correct
22 Incorrect 419 ms 46072 KB Output isn't correct