Submission #112539

# Submission time Handle Problem Language Result Execution time Memory
112539 2019-05-20T12:50:13 Z nxteru Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
850 ms 72840 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
ll f[100005],s[100005];
vector<P>g[100005];
int travel_plan(int n, int m, int R[][2], int L[], int k, int T[]){
	for(int i=0;i<m;i++){
		ll a=R[i][0],b=R[i][1],c=L[i];
		g[a].PB(P(b,c));
		g[b].PB(P(a,c));
	}
	for(int i=0;i<n;i++)f[i]=INF,s[i]=INF;
	priority_queue<P,vector<P>,greater<P>>dik;
	for(int i=0;i<k;i++){
		ll v=T[i];
		f[v]=0;
		s[v]=0;
		dik.push(P(0,v));
	}
	while(!dik.empty()){
		ll c=dik.top().F,v=dik.top().S;
		dik.pop();
		if(s[v]<c)continue;
		for(int i=0;i<g[v].size();i++){
			ll u=g[v][i].F,p=c+g[v][i].S;
			if(f[u]>p)swap(f[u],p);
			if(s[u]>p){
				s[u]=p;
				dik.push(P(p,u));
			}
		}
	}
	return s[0];
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:30:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<g[v].size();i++){
               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Correct 4 ms 2816 KB Output is correct
5 Correct 4 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2816 KB Output is correct
8 Correct 4 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Correct 4 ms 2816 KB Output is correct
5 Correct 4 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2816 KB Output is correct
8 Correct 4 ms 2816 KB Output is correct
9 Correct 6 ms 3072 KB Output is correct
10 Correct 4 ms 2688 KB Output is correct
11 Correct 5 ms 2816 KB Output is correct
12 Correct 8 ms 3328 KB Output is correct
13 Correct 7 ms 3456 KB Output is correct
14 Correct 4 ms 2688 KB Output is correct
15 Correct 5 ms 2816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2688 KB Output is correct
2 Correct 4 ms 2688 KB Output is correct
3 Correct 4 ms 2688 KB Output is correct
4 Correct 4 ms 2816 KB Output is correct
5 Correct 4 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 4 ms 2816 KB Output is correct
8 Correct 4 ms 2816 KB Output is correct
9 Correct 6 ms 3072 KB Output is correct
10 Correct 4 ms 2688 KB Output is correct
11 Correct 5 ms 2816 KB Output is correct
12 Correct 8 ms 3328 KB Output is correct
13 Correct 7 ms 3456 KB Output is correct
14 Correct 4 ms 2688 KB Output is correct
15 Correct 5 ms 2816 KB Output is correct
16 Correct 716 ms 66572 KB Output is correct
17 Correct 128 ms 14420 KB Output is correct
18 Correct 125 ms 16776 KB Output is correct
19 Correct 850 ms 72840 KB Output is correct
20 Correct 335 ms 54524 KB Output is correct
21 Correct 42 ms 8440 KB Output is correct
22 Correct 334 ms 49912 KB Output is correct