Submission #462496

# Submission time Handle Problem Language Result Execution time Memory
462496 2021-08-10T16:11:05 Z fuad27 Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
0 ms 204 KB
#include<bits/stdc++.h>
#include "crocodile.h"
using namespace std;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
vector<vector<pair<int, int>>> adj(N);
for(int i = 0; i < M; i++) {
	int u = R[i][0], v = R[i][1];
	adj[u].emplace_back(v, L[i]);
	adj[v].emplace_back(u, L[i]);
}

vector<int> visited(N, 0);
priority_queue<pair<int, int>> q;
for(int i = 0; i < K; i++) {
	visited[P[i]]++;
	q.emplace(0, P[i]);
}

while(!q.empty()) {
	int d = q.top().first;
	int v = q.top().second;
	q.pop();
	if(visited[v] == 1) {
		visited[v]++;
		if(v == 0) return -d;
		for(auto &[u, w] : adj[v])
			q.emplace(d - w, u);
	}
}
return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -