Submission #756581

# Submission time Handle Problem Language Result Execution time Memory
756581 2023-06-12T00:51:24 Z pavement Crocodile's Underground City (IOI11_crocodile) C++17
89 / 100
487 ms 53156 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

#define eb emplace_back
using ii = pair<int, int>;

int fd[100005], sd[100005];
vector<ii> adj[100005];
priority_queue<ii, vector<ii>, greater<ii> > pq;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
	for (int i = 0; i < M; i++) {
		adj[R[i][0]].eb(R[i][1], L[i]);
		adj[R[i][1]].eb(R[i][0], L[i]);
	}
	for (int i = 0; i < N; i++) {
		fd[i] = sd[i] = (int)2e9;
	}
	for (int i = 0; i < K; i++) {
		fd[P[i]] = sd[P[i]] = 0;
		pq.emplace(0, P[i]);
	}
	while (!pq.empty()) {
		auto [d, v] = pq.top();
		pq.pop();
		if (sd[v] != d) continue;
		if (v == 0) return d;
		for (auto [u, w] : adj[v]) {
			int c = d + w;
			if (c < sd[u]) {
				sd[u] = c;
				if (sd[u] < fd[u]) swap(fd[u], sd[u]);
				pq.emplace(sd[u], u);
			}
		}
	}
	assert(0);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 3 ms 2644 KB Output is correct
3 Correct 3 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2676 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 3 ms 2644 KB Output is correct
3 Correct 3 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2676 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 3 ms 2868 KB Output is correct
10 Correct 2 ms 2668 KB Output is correct
11 Correct 4 ms 2796 KB Output is correct
12 Correct 5 ms 3156 KB Output is correct
13 Correct 4 ms 3156 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 3 ms 2644 KB Output is correct
3 Correct 3 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2676 KB Output is correct
8 Correct 2 ms 2644 KB Output is correct
9 Correct 3 ms 2868 KB Output is correct
10 Correct 2 ms 2668 KB Output is correct
11 Correct 4 ms 2796 KB Output is correct
12 Correct 5 ms 3156 KB Output is correct
13 Correct 4 ms 3156 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2700 KB Output is correct
16 Correct 422 ms 48376 KB Output is correct
17 Correct 103 ms 14888 KB Output is correct
18 Correct 86 ms 15836 KB Output is correct
19 Correct 487 ms 53156 KB Output is correct
20 Correct 279 ms 43132 KB Output is correct
21 Correct 51 ms 7960 KB Output is correct
22 Incorrect 282 ms 38316 KB Output isn't correct
23 Halted 0 ms 0 KB -