Submission #207577

# Submission time Handle Problem Language Result Execution time Memory
207577 2020-03-08T04:46:15 Z aloo123 Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
10 ms 380 KB
#include <bits/stdc++.h>
 #include <crocodile.h>
#define ll int
#define pb push_back
#define mp make_pair
#define s second
#define f first
using namespace std;
#define pii pair<int,int>
const int INF = INT_MAX;
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
	vector<pii> adj[n];
	for(int i =0;i<m;i++){
		int u = r[i][0];
		int v = r[i][1];
		int d = l[i];
		adj[u].push_back(make_pair(u,d));
		adj[v].push_back(make_pair(v,d));
	}
	pii dis[n];
	for(int i =0;i<n;i++) dis[i] = mp(INF,INF);
	priority_queue<pii,vector<pii>,greater<pii>> pq;
	for(int i =0;i<k;i++){
		ll u = p[i];
		pq.push(mp(0,u));
		dis[u].f = 0;
		dis[u].s = 0;
	}

	while(!pq.empty()){
		pii u = pq.top();
		pq.pop();
		for(auto v:adj[u.s]){
			int vertex = v.s;
			if(dis[vertex].f > dis[u.s].f + v.f){
				dis[vertex].s = dis[vertex].f;
				dis[vertex].f = dis[u.s].f + v.f;
				pq.push(mp(dis[vertex].f,vertex));
			}
		}
	}

	return dis[0].s;

}
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -