Submission #214141

# Submission time Handle Problem Language Result Execution time Memory
214141 2020-03-26T10:29:37 Z rapture Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
821 ms 87212 KB
#include "crocodile.h"
#include <bits/stdc++.h>
#define ll long long
#define INF 1e+18
#define pb push_back
using namespace std;
 
struct edge{ ll to,cost; };
typedef pair<int,int> P;
 
ll n,m,d1[100010],d2[100010];
vector<edge> G[100010];
 
int travel_plan(int N, int M, int R[][2], int L[], int K, int Q[]){
	n = N,m = M;
	for(int i = 0;i < n;i++){
		d1[i] = INF;
		d2[i] = INF;
	}
	for(int i = 0;i < m;i++){
		G[R[i][0]].pb({R[i][1],L[i]});
		G[R[i][1]].pb({R[i][0],L[i]});
	}
	priority_queue<P,vector<P>,greater<P>> que;
	for(int i = 0;i < K;i++){
		d1[Q[i]] = 0;
		d2[Q[i]] = 0;
		que.push(P(0,Q[i]));
	}
	while(!que.empty()){
		P p = que.top();que.pop();
		ll v = p.second;
		if(d2[v] < p.first) continue;
		for(edge e : G[v]){
			ll cost = d2[v] + e.cost;
			if(d1[e.to] > cost) swap(d1[e.to],cost);
			if(d2[e.to] > cost){
				d2[e.to] = cost;
				que.push(P(d2[e.to],e.to));
			}
		}
	}
	return d2[0];
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2688 KB Output is correct
2 Correct 7 ms 2816 KB Output is correct
3 Correct 7 ms 2688 KB Output is correct
4 Correct 7 ms 2816 KB Output is correct
5 Correct 7 ms 2816 KB Output is correct
6 Correct 7 ms 2816 KB Output is correct
7 Correct 7 ms 2816 KB Output is correct
8 Correct 7 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2688 KB Output is correct
2 Correct 7 ms 2816 KB Output is correct
3 Correct 7 ms 2688 KB Output is correct
4 Correct 7 ms 2816 KB Output is correct
5 Correct 7 ms 2816 KB Output is correct
6 Correct 7 ms 2816 KB Output is correct
7 Correct 7 ms 2816 KB Output is correct
8 Correct 7 ms 2816 KB Output is correct
9 Correct 8 ms 3072 KB Output is correct
10 Correct 6 ms 2688 KB Output is correct
11 Correct 7 ms 2944 KB Output is correct
12 Correct 10 ms 3456 KB Output is correct
13 Correct 9 ms 3584 KB Output is correct
14 Correct 7 ms 2816 KB Output is correct
15 Correct 8 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2688 KB Output is correct
2 Correct 7 ms 2816 KB Output is correct
3 Correct 7 ms 2688 KB Output is correct
4 Correct 7 ms 2816 KB Output is correct
5 Correct 7 ms 2816 KB Output is correct
6 Correct 7 ms 2816 KB Output is correct
7 Correct 7 ms 2816 KB Output is correct
8 Correct 7 ms 2816 KB Output is correct
9 Correct 8 ms 3072 KB Output is correct
10 Correct 6 ms 2688 KB Output is correct
11 Correct 7 ms 2944 KB Output is correct
12 Correct 10 ms 3456 KB Output is correct
13 Correct 9 ms 3584 KB Output is correct
14 Correct 7 ms 2816 KB Output is correct
15 Correct 8 ms 2816 KB Output is correct
16 Correct 623 ms 81660 KB Output is correct
17 Correct 111 ms 17740 KB Output is correct
18 Correct 132 ms 20228 KB Output is correct
19 Correct 821 ms 87212 KB Output is correct
20 Correct 378 ms 67588 KB Output is correct
21 Correct 52 ms 9860 KB Output is correct
22 Correct 395 ms 64232 KB Output is correct