s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s922687806 | p03608 | u858742833 | 1590810689 | Python | Python (3.4.3) | py | Runtime Error | 139 | 6736 | 960 | from itertools import permutations
import heapq
def dijkstra(N, G, s):
INF = 10**40
d = [INF] * N
d[s] = 0
q = [(0, s)]
while q:
c, v = heapq.heappop(q)
if d[v] < c:
continue
for t, co in G[v]:
if d[v] + co < d[t]:
d[t] = d[v] + co
... |
s654038099 | p03608 | u519923151 | 1590778605 | Python | Python (3.4.3) | py | Runtime Error | 103 | 8032 | 742 | n,m,r = map(int, input().split())
al = list(map(int, input().split()))
from collections import defaultdict
V = defaultdict(list)
for _ in range(m):
a, b,c = map(int, input().split())
V[a].append([b,c])
V[b].append([a,c])
def dfs(source):
dist = [-1]*(n+1)
dist[source] = 0
q = [source]
... |
s245826170 | p03608 | u892487306 | 1590541559 | Python | Python (3.4.3) | py | Runtime Error | 259 | 18500 | 629 | from scipy.sparse.csgraph import floyd_warshall
import itertools
def main():
N, M, R = list(map(int, input().split(' ')))
towns = list(map(lambda t: int(t) - 1, input().split(' ')))
A = np.zeros((N, N), dtype=int)
for _ in range(M):
a, b, c = list(map(int, input().split(' ')))
A[a-1][b... |
s196814795 | p03608 | u285891772 | 1590213846 | Python | PyPy3 (2.4.0) | py | Runtime Error | 566 | 108248 | 1500 | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mu... |
s670454878 | p03608 | u285891772 | 1590213821 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 39120 | 1498 | import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mu... |
s993718567 | p03608 | u347640436 | 1589517942 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 2119 | package main
import (
"bufio"
"fmt"
"math"
"os"
"strconv"
)
//
var (
N int
M int
R int
r []int
d [][]int
)
func min(x, y int) int {
if x < y {
return x
}
return y
}
func fillInts(a []int, x int) {
for i := 0; i < len(a); i++ {
a[i] = x
}
}
func warshallFloyd(n int, d [][]int) {
for k := 0; k < ... |
s446393098 | p03608 | u703950586 | 1589066103 | Python | PyPy3 (2.4.0) | py | Runtime Error | 233 | 42584 | 1219 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**8
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())... |
s461280425 | p03608 | u703950586 | 1589065972 | Python | PyPy3 (2.4.0) | py | Runtime Error | 230 | 42584 | 1222 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**8
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())... |
s758015459 | p03608 | u703950586 | 1589065947 | Python | PyPy3 (2.4.0) | py | Runtime Error | 238 | 42712 | 1222 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**8
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())... |
s445888302 | p03608 | u225388820 | 1588914413 | Python | PyPy3 (2.4.0) | py | Runtime Error | 437 | 48344 | 619 | INF = 10**10
n,m,R = map(int,input().split())
r=list(map(int,input().split()))
d = [[INF]*n for i in range(n)]
# 入力
for i in range(m):
a,b,c = map(int,input().split())
a,b = a-1, b-1
d[a][b] = c
d[b][a] = c # 無向グラフ
for i in range(n):
d[i][i] = 0
def FW():
for i in range(n):
for j in ra... |
s101599202 | p03608 | u225388820 | 1588914332 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4456 | 619 | INF = 10**10
n,m,R = map(int,input().split())
r=list(map(int,input().split()))
d = [[INF]*n for i in range(n)]
# 入力
for i in range(m):
a,b,c = map(int,input().split())
a,b = a-1, b-1
d[a][b] = c
d[b][a] = c # 無向グラフ
for i in range(n):
d[i][i] = 0
def FW():
for i in range(n):
for j in ra... |
s182365344 | p03608 | u478266845 | 1588130390 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 14736 | 911 | import numpy as np
from itertools import permutations
n,m,R = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
mat = np.ones([n,n]) *float('inf')
for i in range(m):
a, b, c = [int(i) for i in input().split()]
a -= 1
b -= 1
mat[a,b] = c
mat[b,a] = c
def floyd_war... |
s942251710 | p03608 | u867320886 | 1588125461 | Python | Python (3.4.3) | py | Runtime Error | 2139 | 437176 | 466 | from scipy.sparse.csgraph import floyd_warshall
import numpy as np
from itertools import permutations
n,m,r = map(int,input().split())
rr = np.array(list(map(int,input().split()))) - 1
L = np.zeros((m,m),int)
for _ in range(m):
a,b,c = map(int,input().split())
L[a-1,b-1] = c
shortest = floyd_warshall(L, dire... |
s921765371 | p03608 | u413165887 | 1586543000 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 95192 | 718 | from collections import deque
import copy
n, m, r = map(int,input().split())
R = list(map(int, input().split()))
tree = [[] for _ in range(n+1)]
for i in range(m):
a, b, c = map(int, input().split())
tree[a].append([b, c])
tree[b].append([a, c])
result = []
for i in R:
visit = [-1 for _ in range(n+1)]
... |
s765603218 | p03608 | u413165887 | 1586542820 | Python | PyPy3 (2.4.0) | py | Runtime Error | 309 | 48728 | 702 | from collections import deque
n, m, r = map(int,input().split())
R = list(map(int, input().split()))
tree = [[] for _ in range(n+1)]
for i in range(m):
a, b, c = map(int, input().split())
tree[a].append([b, c])
tree[b].append([a, c])
result = [10**9]
for i in R:
visit = [-1 for _ in range(n+1)]
vis... |
s153797130 | p03608 | u413165887 | 1586542583 | Python | PyPy3 (2.4.0) | py | Runtime Error | 329 | 48728 | 697 | from collections import deque
n, m, r = map(int,input().split())
R = list(map(int, input().split()))
tree = [[] for _ in range(n+1)]
for i in range(m):
a, b, c = map(int, input().split())
tree[a].append([b, c])
tree[b].append([a, c])
result = []
for i in R:
visit = [-1 for _ in range(n+1)]
visit[i]... |
s541580734 | p03608 | u413165887 | 1586542560 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 43464 | 697 | from collections import deque
n, m, r = map(int,input().split())
R = list(map(int, input().split()))
tree = [[] for _ in range(n+1)]
for i in range(m):
a, b, c = map(int, input().split())
tree[a].append([b, c])
tree[b].append([a, c])
result = []
for i in R:
visit = [-1 for _ in range(n+1)]
visit[i]... |
s535219408 | p03608 | u388927326 | 1586352393 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 1006 | #!/usr/bin/env python3
from itertools import permutations
from numba import jit
import numpy as np
HUGE = 10 ** 18
def main():
n, m, r = map(int, input().split())
togo = list(map(int, input().split()))
adj_mat = [[HUGE for j in range(n)] for i in range(n)]
for i in range(n):
adj_mat[i][i] = H... |
s583567585 | p03608 | u877415670 | 1584905380 | Python | PyPy3 (2.4.0) | py | Runtime Error | 317 | 47064 | 954 | import heapq
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
for i in range(R):
r[i] -= 1
edge = [[] for i in range(N)]
for i in range(M):
x, y, z = map(int, input().split())
edge[x-1].append((z, y-1))
edge[y-1].append((z, x-1))
MIN = 10**10
for i in range(R):
ans = 0
d ... |
s124394312 | p03608 | u577170763 | 1584731949 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 778 | import itertools
from scipy.sparse.csgraph import floyd_warshall
N, M, R = map(int, input().split())
r = tuple(map(int, input().split()))
INF = 10**10
d = [[INF] * N for _ in range(N)]
for i in range(N):
d[i][i] = 0
for _ in range(M):
a, b, c = map(int, input().split())
a -= 1
b -= 1
if d[a][b]... |
s753668826 | p03608 | u577170763 | 1584731039 | Python | Python (3.4.3) | py | Runtime Error | 312 | 18216 | 676 | import itertools
from scipy.sparse.csgraph import floyd_warshall
N, M, R = map(int, input().split())
r = tuple(map(int, input().split()))
INF = 10**10
d = [[INF] * N for _ in range(N)]
for i in range(N):
d[i][i] = 0
for _ in range(M):
a, b, c = map(int, input().split())
a -= 1
b -= 1
if d[a][b]... |
s085417228 | p03608 | u577170763 | 1584730524 | Python | Python (3.4.3) | py | Runtime Error | 242 | 17360 | 838 | import itertools
from scipy.sparse import scr_matrix
from scipy.sparse.csgraph import froyd_warshall
N, M, R = map(int, input().split())
r = tuple(map(int, input().split()))
INF = 10**10
d = [[INF] * (N+1) for _ in range(N+1)]
for i in range(N+1):
d[i][i] = 0
for _ in range(M):
a, b, c = map(int, input().... |
s723654659 | p03608 | u179169725 | 1584159864 | Python | Python (3.4.3) | py | Runtime Error | 2192 | 1271112 | 997 | # https://atcoder.jp/contests/abc073/tasks/abc073_d
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
# default import
from itertools import product, permutations, combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
# ダイクストラか?
... |
s844864717 | p03608 | u179169725 | 1584159661 | Python | Python (3.4.3) | py | Runtime Error | 2186 | 1271032 | 946 | # https://atcoder.jp/contests/abc073/tasks/abc073_d
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
# default import
from itertools import product, permutations, combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
# ダイクストラか?
... |
s186845905 | p03608 | u179169725 | 1584159455 | Python | Python (3.4.3) | py | Runtime Error | 2198 | 1279268 | 936 | # https://atcoder.jp/contests/abc073/tasks/abc073_d
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
# default import
from itertools import product, permutations, combinations
from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.csgraph import dijkstra
... |
s113359283 | p03608 | u523130469 | 1584131636 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2304 | 231432 | 662 | from itertools import permutations as perm
n, m, r = map(int, input().split())
r = list(map(lambda x: int(x) - 1, input().split()))
d = [[10 ** 5] * m for _ in range(m)]
for i in range(m):
abc = tuple(map(int, input().split()))
a = abc[0] - 1
b = abc[1] - 1
c = abc[2]
d[a][b] = c
d[b][a] = c
fo... |
s682727075 | p03608 | u476604182 | 1583957649 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38256 | 534 | from itertools import permutations
N, M, R, *L = map(int, open('0').read().split())
city = L[:R]
inf = L[R:]
dist = [[10**10]*N for i in range(N)]
for x,y,c in zip(*[iter(inf)]*3):
dist[x-1][y-1] = c
dist[y-1][x-1] = c
for i in range(N):
dist[i][i] = 0
for k in range(N):
for i in range(N):
for j in range(N... |
s025341551 | p03608 | u595289165 | 1583313385 | Python | Python (3.4.3) | py | Runtime Error | 166 | 12792 | 634 | n, m, R = map(int, input().split())
r = list(map(int, input().split()))
inf = 10**10
graph = [[] for _ in range(n+1)]
for _ in range(m):
a, b, c = map(int, input().split())
graph[a].append([b, c])
graph[b].append([a, c])
def dfs(visited, r_num, length):
if r_num == R:
return length
now = v... |
s770768561 | p03608 | u098012509 | 1583221426 | Python | PyPy3 (2.4.0) | py | Runtime Error | 162 | 38256 | 809 | import sys
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
import itertools
input = sys.stdin.readline
def main():
N, M, R = [int(x) for x in input().split()]
r = [int(x) - 1 for x in input().split()]
ABC = [[int(x) for x in input().spli... |
s798475102 | p03608 | u231095456 | 1582267629 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 1064 | #include <iostream>
#include <algorithm>
#include <vector>
//#include <string>
#include <queue>
//#include <functional>
using namespace std;
int main() {
const long INF = 100000*200;
int N, M, R;
cin >> N >> M >> R;
vector<int> r;
for (int i=0; i<R; i++) {
int x;
cin >> x;
... |
s133485289 | p03608 | u852690916 | 1581681880 | Python | PyPy3 (2.4.0) | py | Runtime Error | 449 | 47064 | 521 | N,M,R=map(int, input().split())
r=map(lambda x:int(x)-1, input().split())
dp=[[10**9]*N for _ in range(N)]
for _ in range(M):
A,B,C=map(int, input().split())
A-=1
B-=1
dp[A][B]=C
dp[B][A]=C
for z in range(N):
for x in range(N):
for y in range(N):
dp[x][y]=min(dp[x][y], dp[x][... |
s197288133 | p03608 | u711539583 | 1580969919 | Python | Python (3.4.3) | py | Runtime Error | 619 | 16096 | 684 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s188025408 | p03608 | u711539583 | 1580969487 | Python | Python (3.4.3) | py | Runtime Error | 452 | 16084 | 622 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s301587102 | p03608 | u711539583 | 1580969305 | Python | Python (3.4.3) | py | Runtime Error | 401 | 23556 | 622 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s609884055 | p03608 | u711539583 | 1580968826 | Python | Python (3.4.3) | py | Runtime Error | 615 | 20524 | 641 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s684147795 | p03608 | u711539583 | 1580968676 | Python | Python (3.4.3) | py | Runtime Error | 663 | 27396 | 641 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s700985803 | p03608 | u711539583 | 1580968636 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38640 | 641 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())
... |
s319344410 | p03608 | u682985065 | 1580545755 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4592 | 708 | def warshall_floyd(n, dist):
min_dist = dist.copy()
for k in range(n):
for i in range(n):
for t in range(n):
min_dist[i][t] = min(min_dist[i][t], min_dist[i][k] + min_dist[k][t])
return min_dist
n, m, r = map(int, input().split())
r = list(map(int, input().s... |
s757278214 | p03608 | u779455925 | 1580518361 | Python | PyPy3 (2.4.0) | py | Runtime Error | 387 | 51544 | 1933 | from collections import *
from itertools import *
import copy
N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
data[a].append(b)
data[b].append(a)
A,B=min(a,b),max(a,b)
na... |
s249994762 | p03608 | u779455925 | 1580516514 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2108 | 57176 | 1274 | from collections import *
from itertools import *
import copy
N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
data[a].append(b)
data[b].append(a)
A,B=min(a,b),max(a,b)
na... |
s341423508 | p03608 | u779455925 | 1580516395 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 63064 | 1378 | from collections import *
from itertools import *
import copy
N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]
data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
data[a].append(b)
data[b].append(a)
A,B=min(a,b),max(a,b)
na... |
s305133970 | p03608 | u329407311 | 1580504237 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38640 | 589 | from scipy.sparse.csgraph import csgraph_from_dense,dijkstra,floyd_warshall
N,M,R = map(int,input().split())
machi = list(map(int,input().split()))
List = [[10**6]*(N) for i in range(N)]
for i in range(M):
a,b,c = map(int,input().split())
if List[a-1][b-1] > c:
List[a-1][b-1] = c
List[b-1][a-1] = c
G =... |
s838655976 | p03608 | u441575327 | 1580255329 | Python | Python (3.4.3) | py | Runtime Error | 424 | 18732 | 765 | import math
import numpy as np
from scipy.sparse.csgraph import dijkstra
N,M,R = list(map(int,input().split()))
r = list(map(int,input().split()))
for i in range(R):
r[i] -= 1
connections = np.zeros((N,N))
for i in range(M):
A,B,C = list(map(int,input().split()))
A,B = A-1,B-1
connections[A][B] =... |
s829334007 | p03608 | u530606147 | 1579662870 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 12348 | 669 | n, m, R = list(map(int, input().split()))
r = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
import math
d = defaultdict(lambda: math.inf)
for a, b, c in abc:
d[(a, b)] = c
d[(b, a)] = c
for x in range(1, n + 1):
d[(x, x)] = 0
for... |
s948137726 | p03608 | u530606147 | 1579662671 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 12928 | 641 | n, m, R = list(map(int, input().split()))
r = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
import math
d = defaultdict(lambda: math.inf)
for a, b, c in abc:
d[(a, b)] = c
d[(b, a)] = c
for x in range(1, n + 1):
d[(x, x)] = 0
for... |
s489317438 | p03608 | u530606147 | 1579662586 | Python | Python (3.4.3) | py | Runtime Error | 83 | 7496 | 645 | n, m, R = list(map(int, input().split()))
r = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
from math import inf
d = defaultdict(lambda: inf)
for a, b, c in abc:
d[(a, b)] = c
d[(b, a)] = c
for x in range(1, n + 1):
d[(x, x)] = 0
... |
s186867066 | p03608 | u989345508 | 1579194236 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 814 | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define INF 100000000000
signed main(){
ll n,m,r;cin >> n >> m >> r;
vector<ll> rx(r);for(int i=0;i<r;i++)cin >> rx[i];
vector<vector<ll>> wf(n,vector<ll>(n,INF));
for(int i=0;i<n;i++) wf[i][i]=0;
for(int i=0;i... |
s714071959 | p03608 | u123756661 | 1578937751 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1051 | #include<bits/stdc++.h>
using namespace std;
#define inf 1<<29
int n,m,r;
int d[201][201];
int a,b,c;
int res;
void warshall_floyd(int n) {
//for (int i=0;i<n;i++) for (int j=0;j<n;j++) for (int k=0;k<n;k++) d[j][k]=min(d[j][k], d[j][i]+d[i][k]);
for (int i=0;i<n;i++) for (int j=0;j<n;j++) for (int k=0;k<i+1;... |
s164746930 | p03608 | u970197315 | 1578271377 | Python | PyPy3 (2.4.0) | py | Runtime Error | 559 | 50008 | 605 | # ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
dist=[inf]*N
visited=[False]*N
for i in range(M):
a,b,c=map(int,input().split())
mat[a-1][b-1]=c
mat[b-1][a-1]=c
for i in range(R):
r[i]-=1
... |
s328240732 | p03608 | u970197315 | 1578271259 | Python | PyPy3 (2.4.0) | py | Runtime Error | 540 | 50008 | 599 | # ABC073 D - joisino's travel
import itertools
N,M,R=map(int, input().split())
r=list(map(int, input().split()))
inf=float("inf")
mat=[[inf]*N for _ in range(N)]
dist=[inf]*N
visited=[False]*N
for i in range(M):
a,b,c=map(int,input().split())
mat[a-1][b-1]=mat[b-1][a-1]=c
for i in range(R):
r[i]-=1
ans=in... |
s867685861 | p03608 | u708255304 | 1577468461 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38384 | 1202 | from scipy.sparse.csgraph import floyd_warshall
import itertools
def warshal_floyd(d):
# d[i][j] := iからjへの最短距離
global N
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
# "今現在求まっているiからjへの最短距離"と"今現在求まっているiからkへの最短距離 + ... |
s547013788 | p03608 | u708255304 | 1577468404 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38256 | 1164 | from scipy.sparse.csgraph import floyd_warshall
import itertools
def warshal_floyd(d):
# d[i][j] := iからjへの最短距離
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j] = min(d[i][j], d[i][k] + d[k][j])
# "今現在求まっているiからjへの最短距離"と"今現在求まっているiからkへの最短距離 + 今現在求まっているkからj... |
s226836976 | p03608 | u560988566 | 1576697245 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38256 | 792 | import sys
input = sys.stdin.readline
import numpy as np
N,M,R = map(int, input().split())
r = list(map(int, input().split()))
ds = np.zeros([N,N])
neighbors = [[]]*N
for _ in range(M):
a,b,c = map(int, input().split())
ds[a-1][b-1] = c
ds[b-1][a-1] = c
neighbors[a-1].append(b-1)
neighbors[b-1].ap... |
s014904208 | p03608 | u150603590 | 1576547430 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 1356 | from scipy.sparse.csgraph import floyd_warshall
def warshal_floyd(weights,N):
d=[[weights[(i,j)] for i in range(N)] for j in range(N)]
for i in range(N):
d[i][i]=0
for i in range(N):
for j in range(N):
for k in range(N):
d[i][j]=min(d[i][j],d[i][k]+d[k][j])
r... |
s106543957 | p03608 | u945181840 | 1575841149 | Python | Python (3.4.3) | py | Runtime Error | 725 | 29716 | 690 | import sys
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
from itertools import permutations
read = sys.stdin.read
readline = sys.stdin.readline
N, M, R = map(int, readline().split())
r = list(map(int, readline().split()))
ABC = map(int, read().split())
A, B, C = map(list, zip(*zip(... |
s219686623 | p03608 | u945181840 | 1575841070 | Python | Python (3.4.3) | py | Runtime Error | 520 | 19764 | 654 | import sys
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
from itertools import permutations
read = sys.stdin.read
readline = sys.stdin.readline
N, M, R = map(int, readline().split())
r = list(map(int, readline().split()))
ABC = map(int, read().split())
A, B, C = map(list, zip(*zip(... |
s306518470 | p03608 | u945181840 | 1575838520 | Python | Python (3.4.3) | py | Runtime Error | 271 | 23324 | 638 | import sys
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import coo_matrix
from itertools import permutations
read = sys.stdin.read
readline = sys.stdin.readline
N, M, R = map(int, readline().split())
r = list(map(int, readline().split()))
ABC = map(int, read().split())
INF = float('inf')
ABC = zi... |
s459639576 | p03608 | u077291787 | 1575812683 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38384 | 1519 | # ABC073D - joisino's travel
from heapq import heappop, heappush
from itertools import permutations
from typing import List, Tuple
INF = 1 << 30
def dijkstra(source: int, edges: List[Tuple[int, int]]) -> List[int]:
"""
Compute the distance of the shortest path from V_source to each vertex.
Args:
... |
s298446672 | p03608 | u511379665 | 1575565335 | Python | Python (3.4.3) | py | Runtime Error | 629 | 17064 | 538 | from scipy.sparse.csgraph import dijkstra,floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
N,M,R=map(int,input().split())
r=[int(x)-1 for x in input().split()]
A=[]
B=[]
C=[]
for i in range(M):
x,y,z=map(int,input().split())
A.append(x-1)
B.append(y-1)
C.append(z)
... |
s547114512 | p03608 | u511379665 | 1575564403 | Python | Python (3.4.3) | py | Runtime Error | 663 | 19624 | 539 | from scipy.sparse.csgraph import dijkstra,floyd_warshall
from scipy.sparse import csr_matrix
from itertools import permutations
N,M,R=map(int,input().split())
r=[int(x)-1 for x in input().split()]
A=[]
B=[]
C=[]
for i in range(M):
x,y,z=map(int,input().split())
A.append(x-1)
B.append(y-1)
C.append(z)
... |
s409948738 | p03608 | u038815010 | 1575177034 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38384 | 462 | from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall
n,m,R=map(int,input().split())
r=list(map(int,input().split()))
s=[[0]*n for i in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
a, b = a-1, b-1
s[a][b] = c
s[b][a] = c
s=floyd_warshall(s)
ans... |
s753070469 | p03608 | u470542271 | 1575006942 | Python | PyPy3 (2.4.0) | py | Runtime Error | 311 | 47320 | 602 | N, M, R = map(int, input().split())
r = list(map(int, input().split()))
abc = [list(map(int, input().split())) for _ in range(M)]
cost = [[float('inf')] * N for _ in range(N)]
for i in range(M):
a, b, c = abc[i][0], abc[i][1], abc[i][2]
cost[a-1][b-1] = c
cost[b-1][a-1] = c
from scipy.sparse.csgraph impor... |
s556156353 | p03608 | u141610915 | 1574321405 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2110 | 121308 | 865 | import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
ss = set(r)
d = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
a, b, c = map(int, input().split())
d[a][b] = c
d[b][a] = c
res = float("inf")
for s in range(... |
s525166424 | p03608 | u223904637 | 1573335920 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 525 | from collections import permutations
n,m,r=map(int,input().split())
rr=list(map(int,input().split()))
inf=10000000000
g=[[inf for i in range(n)] for j in range(n)]
for i in range(m):
a,b,c=map(int,input().split())
g[a-1][b-1]=c
g[b-1][a-1]=c
for k in range(n):
for i in range(n):
for j in range(n... |
s726893558 | p03608 | u432356156 | 1573010757 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 507 | ソースコード
Copy
Copy
from scipy.sparse import *
from itertools import *
n,m,r = [int(x) for x in input().split()]
R = [int(i)-1 for i in input().split()]
route_list = [[0]*n for i in range(n)]
ans = 10**9
for j in range(m):
a,b,c = map(int,input().split())
route_list[a-1][b-1] = c
route_list[b-1][a-1] = c
Co = ... |
s820110155 | p03608 | u432356156 | 1573010743 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 511 | ソースコード
Copy
Copy
from scipy.sparse import *
from itertools import *
n,m,r = [int(x) for x in input().split()]
R = [int(i)-1 for i in input().split()]
route_list = [[10**8]*n for i in range(n)]
ans = 10**9
for j in range(m):
a,b,c = map(int,input().split())
route_list[a-1][b-1] = c
route_list[b-1][a-1] = c
C... |
s948951317 | p03608 | u195608881 | 1573009514 | Python | Python (3.4.3) | py | Runtime Error | 151 | 12728 | 619 | import numpy
import sys
import itertools
input = sys.stdin.readline
inf = 200000000
n, m, r = map(int, input().split())
rs = list(map(int, input().split()))
n1 = n + 1
d = numpy.full((n1 * n1), inf)
for i in range(n1):
d[i, i] = 0
for i in range(m):
a, b, c = map(int, input().split())
d[a * n1 + b] = d[b, +... |
s229574849 | p03608 | u432356156 | 1573007235 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 799 | import math
from itertools import permutations
import numpy as np
#from scipy.sparse import*
def warshall_floyd(d):
#d[i][j]: iからjへの最短距離
n=len(d[0])
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
N,M,R=[int... |
s286025044 | p03608 | u432356156 | 1573007214 | Python | PyPy3 (2.4.0) | py | Runtime Error | 176 | 38384 | 799 | import math
from itertools import permutations
import numpy as np
#from scipy.sparse import*
def warshall_floyd(d):
#d[i][j]: iからjへの最短距離
n=len(d[0])
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
N,M,R=[int... |
s113119894 | p03608 | u432356156 | 1573007123 | Python | Python (3.4.3) | py | Runtime Error | 149 | 12480 | 800 | import math
from itertools import permutations
import numpy as np
#from scipy.sparse import*
def warshall_floyd(d):
#d[i][j]: iからjへの最短距離
n=len(d[0])
for k in range(n):
for i in range(n):
for j in range(n):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
N,M,R=[int... |
s125522517 | p03608 | u899975427 | 1572475289 | Python | Python (3.4.3) | py | Runtime Error | 697 | 19768 | 436 | from scipy.sparse import*
from itertools import*
n,m,r = map(int,input().split())
R = [int(i)-1 for i in input().split()]
cost = [[0]*n for i in range(n)]
ans = 10**9
for j in range(m):
a,b,c = map(int,input().split())
cost[a-1][b-1] = c
cost[b-1][a-1] = c
Co = csgraph.shortest_path(csr_matrix(cost))
for v in p... |
s275199685 | p03608 | u924374652 | 1571880400 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 829 | import itertools
def warshall_floyd(d):
len_d = len(d)
for k in range(len_d):
for i in range(len_d):
for j in range(len_d):
if d[i][j] < d[i][k] + d[k][j]:
d[i][j] = d[i][k] + d[k][j]
return d
def main():
n, m, r = map(int, input().split())
list_r = list(map(int, input().split())... |
s300000831 | p03608 | u934868410 | 1571277858 | Python | PyPy3 (2.4.0) | py | Runtime Error | 318 | 45544 | 730 | import itertools
n,m,R = map(int,input().split())
r = list(map(int,input().split()))
cost = [[-1]*n for i in range(n)]
for i in range(m):
a,b,c = map(int,input().split())
cost[a-1][b-1] = c
cost[b-1][a-1] = c
for k in range(n):
for i in range(n):
for j in range(n):
if cost[i][k] == ... |
s489440334 | p03608 | u934868410 | 1571244557 | Python | Python (3.4.3) | py | Runtime Error | 81 | 5836 | 314 | import itertools
n,m,R = map(int,input().split())
r = list(map(int,input().split()))
cost = {}
for i in range(m):
a,b,c = map(int,input().split())
cost[(a,b)] = c
ans = 1000000
for p in itertools.permutations(r):
c = 0
for i in range(len(r)-1):
c += cost[(p[i], p[i+1])]
ans = min(c, ans)
print(ans) |
s562922341 | p03608 | u644907318 | 1571074390 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 904 | itertools,heapq
INFTY = 10**8
N,M,R = map(int,input().split())
R = list(map(int,input().split()))
G = {}
for _ in range(M):
A,B,C = map(int,input().split())
if A not in G:
G[A] = []
G[A].append((B,C))
if B not in G:
G[B] = []
G[B].append((A,C))
D = [[INFTY for j in range(N+1)] for i... |
s813875500 | p03608 | u077291787 | 1570886489 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1154 | # ABC073D - joisino's travel (210ms)
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [1 << 60] * size
unchecked = size - 1 # vertex_0 won't appear in 1-idx graph
queue = [(0, start)]
heapify(qu... |
s488751376 | p03608 | u077291787 | 1570883477 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8628 | 1151 | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
searched = [0] * size
dist[start], searched[start] = 0, 1
queue = G[start]
heapify(queue)
... |
s214757094 | p03608 | u077291787 | 1570883202 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8640 | 1086 | # ABC073D - joisino's travel
from heapq import heapify, heappop, heappush
from itertools import permutations
def dijkstra(G: "Array[Array[int]]", size: int, start: int) -> list:
dist = [float("inf")] * size
searched = [0] * size
dist[start], searched[start] = 0, 1
queue = G[start]
heapify(queue)
... |
s268634192 | p03608 | u094191970 | 1569625587 | Python | PyPy3 (2.4.0) | py | Runtime Error | 179 | 38384 | 552 | import itertools
from scipy.sparse.csgraph import floyd_warshall
N,M,R=map(int,input().split())
r=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(M)]
s=[[float('inf') for i in range(N)] for i in range(N)]
for i in range(M):
a,b,c=l[i]
s[a-1][b-1]=c
s[b-1][a-1]=c
for i in ra... |
s835940653 | p03608 | u787456042 | 1568143407 | Python | Python (3.4.3) | py | Runtime Error | 263 | 18104 | 305 | from itertools import*;from scipy.sparse.csgraph import*
N,M,R=map(int,input().split());r=map(int,input().split())
G=[[9e9]*N for _ in[0]*N]
for _ in[0]*M:A,B,C=map(int,input().split());G[A-1][B-1]=G[B-1][A-1]=C
D=dijkstra(G)
print(int(min(sum(D[i-1,j-1]for i,j in zip(t,t[1:]))for t in permutations(r)))) |
s508549493 | p03608 | u912862653 | 1567969593 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 805 | import sys
input = sys.stdin.readline
def main():
import itertools
def warshall_floyd(D, n):
for k in range(n):
for i in range(n):
for j in range(n):
D[i][j] = min(D[i][j], D[i][k]+D[k][j])
N, M, R = map(int, input().split())
r = list(map(i... |
s819515706 | p03608 | u423585790 | 1566933345 | Python | PyPy3 (2.4.0) | py | Runtime Error | 426 | 55772 | 1956 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(m... |
s765983596 | p03608 | u423585790 | 1566933323 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 38768 | 1952 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(m... |
s290562869 | p03608 | u423585790 | 1566933284 | Python | PyPy3 (2.4.0) | py | Runtime Error | 433 | 55772 | 1948 | #!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(m... |
s744610036 | p03608 | u887207211 | 1566015385 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 40664 | 597 | N, M, R = map(int,input().split())
r = list(map(int,input().split()))
ABC = [list(map(int,input().split())) for _ in range(M)]
inf = int(1e9+7)
costs = [[inf if i != j else 0 for j in range(N+1)]for i in range(M+1)]
for a, b, c in ABC:
if costs[a][b] > c:
costs[a][b] = costs[b][a] = c
for i in range(N):
for ... |
s982669244 | p03608 | u728566015 | 1564793544 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1180 | --F1 No73.py Bot (90,0) (Py Outl FlyC WS Undo-Tree AC) 8:51PM 1.27 -------------
# d[i][i] < 0 なら、グラフは負のサイクルを持つ
for k in range(self.N):
for i in range(self.N):
for j in range(self.N):
self.d[i][j] = min(self.d[i][j],
... |
s624355402 | p03608 | u865741247 | 1564105651 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38640 | 697 |
import itertools
from scipy.sparse.csgraph import floyd_warshall as wf
def do():
N,M,R = list(map(int,input().split(" ")))
rs = list(map(int,input().split(" ")))
INF = float('inf')
graph = [ [INF for _ in range(N + 1)]for _ in range(N + 1)]
for _ in range(M):
a,b,c = (map(int, input().spl... |
s566333668 | p03608 | u665038048 | 1563567815 | Python | Python (3.4.3) | py | Runtime Error | 356 | 24496 | 663 | from collections import deque
import itertools
from scipy.sparse.csgraph import floyd_warshall as wf
import sys
MAX = 1e9
def main():
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
link = [[MAX if j != i else 0 for j in range(n+1)] for i in range(n+1)]
for i in range(m):
... |
s403309085 | p03608 | u064246852 | 1563340554 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8140 | 1194 | N,M,R=map(int,input().split())
r = list(map(lambda x:int(x)-1,input().split()))
edge = [[] for _ in range(N)]
for i in range(M):
a,b,c = map(int,input().split())
a -= 1
b -= 1
edge[a].append((b, c))
edge[b].append((a, c))
path = [[None for _ in range(N)] for _ in range(N)]
def bfs(i):
q = [(i,0)... |
s790090371 | p03608 | u623687794 | 1563057549 | Python | Python (3.4.3) | py | Runtime Error | 78 | 3956 | 505 | from itertools import permutations
n,m,r=map(int,input().split())
visit=list(map(int,input().split()))
dist=[[10**9]*n for i in range(n)]
for i in range(m):
a,b,c=map(int,input().split())
dist[a-1][b-1],dist[b-1][a-1]=c,c
for i in range(n):
dist[i-1][i-1]=0
for i in range(n):
for j in range(n):
for k in ran... |
s467821898 | p03608 | u905268546 | 1562773895 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38256 | 620 | import itertools
import numpy
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
r = list(map(lambda x: x - 1, r))
d = numpy.array([[10 ** 10] * N for _ in range(N)])
for _ in range(M):
a, b, c = map(int, input().split())
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
for i in range(N):
... |
s995015347 | p03608 | u133886644 | 1562734432 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1942 | use std::io::stdin;
use std::time::SystemTime;
#[allow(dead_code)]
fn read_line() -> String {
let mut s = String::new();
stdin().read_line(&mut s).unwrap();
s.trim().to_string()
}
#[allow(dead_code)]
fn read<T>() -> T
where T: std::str::FromStr
{
read_line().parse::<T>().ok().unwrap()
}
#[allow(dead_... |
s382886164 | p03608 | u408760403 | 1562350662 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 462 | from itertools import permutations
N,M,R=map(int,input().split())
r=[int(i) for i in range(R)]
inf=10**9
d=[[inf]*N for i in range(N)]
for i in range(M):
A,B,C=map(int,input().split())
d[A-1][B-1]=C
d[B-1][A-1]=C
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j]=min(d[i][j],d[i][k]+d[k]... |
s130516130 | p03608 | u211160392 | 1561835732 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1082 | 92252 | 884 | import sys
input = sys.stdin.readline
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
S = [[]for i in range(N)]
for i in range(M):
a,b,c = map(int,input().split())
S[a-1].append([b-1,c])
S[b-1].append([a-1,c])
d = [[float('inf')]*N for i in range(N)]
queue = []
for i in range(N):
qu... |
s323045493 | p03608 | u211160392 | 1561835610 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1068 | 92252 | 880 | import sys
input = sys.stdin.readline
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
S = [[]for i in range(N)]
for i in range(M):
a,b,c = map(int,input().split())
S[a-1].append([b-1,c])
S[b-1].append([a-1,c])
d = [[float('inf')]*N for i in range(N)]
queue = []
for i in range(N):
qu... |
s985632990 | p03608 | u497596438 | 1561302785 | Python | PyPy3 (2.4.0) | py | Runtime Error | 442 | 46568 | 423 | N,M,R=map(int,input().split())
INF=10**9
d=[[INF]*N for i in range(N)]
r=list(map(int,input().split()))
for i in range(M):
A,B,C=map(int,input().split())
d[A-1][B-1]=C
d[B-1][A-1]=C
for k in range(N):
for i in range(N):
for j in range(N):
d[i][j]=min(d[i][j],d[i][k]+d[k][j])
ans=10**9
for L in permuta... |
s094006560 | p03608 | u086980944 | 1560629930 | Python | PyPy3 (2.4.0) | py | Runtime Error | 585 | 74200 | 1911 | inf = float('inf')
n, m, r = map(int, input().split())
rs = [r-1 for r in list(map(int, input().split()))]
ds = [[inf] * n for _ in range(n)]
for i in range(n):
ds[i][i] = 0
for mm in range(m):
a, b, c = map(int, input().split())
a, b = a-1, b-1
ds[a][b] = c
ds[b][a] = c
## warshall floyd
for k in r... |
s579166215 | p03608 | u399721252 | 1560059504 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 4596 | 614 | n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]
road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]
for i in range(m):
s, e, d = [ int(v) - 1 for v in input().split() ]
road_matrix[s][e] = d + 1
road_matrix[e][s] = d + 1
for k in range(n):
for i in r... |
s569869235 | p03608 | u399721252 | 1560056443 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 7856 | 1055 | n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]
road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]
for i in range(m):
s, e, d = [ int(v) - 1 for v in input().split() ]
road_matrix[s][e] = d + 1
road_matrix[e][s] = d + 1
min_dist_matrix = []
for h in r... |
s677093984 | p03608 | u399721252 | 1560052721 | Python | Python (3.4.3) | py | Runtime Error | 90 | 4596 | 463 |
n, m, r = [ int(v) for v in input().split() ]
town_list = [ int(v)-1 for v in input().split() ]
road_matrix = [ [ 10**9 for j in range(n) ] for i in range(n) ]
for i in range(m):
s, e, d = [ int(v) - 1 for v in input().split() ]
road_matrix[s][e] = d + 1
road_matrix[e][s] = d + 1
mindist = 10**9
for i in iterto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.