Submission #322312

# Submission time Handle Problem Language Result Execution time Memory
322312 2020-11-14T12:43:53 Z Farrius Crocodile's Underground City (IOI11_crocodile) C++11
0 / 100
2000 ms 364 KB
#include "crocodile.h"
#include <bits/stdc++.h>

#define len(x) (int) x.size()
#define f first
#define s second
using namespace std;
using ll = long long;
using ld = long double;

const int INF = 1e9;

int travel_plan (int n, int m, int r[][2], int l[], int k, int p[]) {
	vector<pair<int, int>> g[n];
	for (int i = 0; i < m; i++) {
		int u = r[i][0], v = r[i][1];
		g[u].push_back(make_pair(v, l[i]));
		g[v].push_back(make_pair(u, l[i]));
	}
	vector<int> dist(n, INF);
	priority_queue<pair<ll, int>> pq;
	bool vis[n];
	memset(vis, false, sizeof(vis));
	pq.push(make_pair(0, 0));
	dist[0] = 0;
	while (!pq.empty()) {
		int v = pq.top().s;
		if (vis[v]) continue;
		vis[v] = true;
		for (auto u : g[v]) {
			if (dist[u.f] > dist[v] + u.s) {
				dist[u.f] = dist[v] + u.s;
				pq.push(make_pair(-dist[u.f], u.s));
			}
		}
	}
	int sol = 0;
	for (int i = 0; i < k; i++) {
		sol = max(sol, dist[p[i]]);
	}
	return sol;
}

# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -