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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s097961722 | p03836 | u026155812 | 1553964528 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 7 | 0 0 1 2 |
s354226650 | p03836 | u065446124 | 1545168540 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 169 | sx, sy, tx, ty=map(int, input().split())
print("D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"*(tx-sx+1)+"D"*(tx-sx)+
"L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"*(tx-sx+1)"L"*(tx-sx)) |
s119023982 | p03836 | u283846680 | 1544220991 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 261 | sx, sy, tx, ty = map(int, input().split())
dx = tx - sx
dy = ty - sy
a = iter[dx, dy, dx, dy+1, dx+1, dy+1, dx+1, dy+1,]
w = "R"*next(a) + "U"*next(a) + "L"*next(a) + "D"*next(a) + "R"*next(a) + "U"*next(a) + "L" + "U" + "L"*next(a) + "D"*next(a) + "R"
print(w) |
s461516083 | p03836 | u513081876 | 1535937631 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 433 | N = int(input())
A = list(map(int, input().split()))
ans = 1
if N % 2 == 0:
for i in list(range(1, N, 2)):
if A.count(i) != 2:
ans = 0
break
else:
if A.count(0) == 1:
for i in list(range(2, N, 2)):
if A.count(i) != 2:
ans = 0
... |
s191868580 | p03836 | u140251125 | 1533483005 | Python | Python (3.4.3) | py | Runtime Error | 24 | 3700 | 444 | # input
sx, sy, tx, ty = map(int, input().split())
for i in range(tx - sx):
print('R')
for i in range(ty - sy):
print('U')
for i in range(tx - sx):
print('L')
for i in range(ty - sy):
print('D')
print('L')
for i in range(ty - sy + 1):
print('U')
for i in range(tx - sx + 1):
print('R')
pr... |
s454331580 | p03836 | u653005308 | 1521781513 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 264 | import sys
2.
3.stdin = sys.stdin
4.na = lambda: list(map(int, stdin.readline().split()))
5.
6.k,s = na()
7.ans = 0
8.for x in range(k+1):
9. for y in range(k+1):
10. z = s - (x+y)
11. if z >= 0 and z <= k:
12. ans += 1
13.print(ans)
|
s657448791 | p03836 | u005388620 | 1520308559 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 457 | lis = list(map(int, input().split()))
a=lis[0], b=lis[1], c=lis[2], d=lis[3]
x=c-a, y=d-b
for i in range(x):
print('R', end='')
for i in range(y):
print('U', end='')
for i in range(x):
print('L', end='')
for i in range(y+1):
print('D', end='')
for i in range(x+1):
print('R', end='')
for i in range(... |
s397269162 | p03836 | u089230684 | 1507011725 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 571 | sx, sy, tx, ty = [int(x) for x in input().strip()]
# A = (sx,sy) B = (tx,ty)
S = ''
def move(a,b):
global x,y,S
if a-x>0:
for i in range(a-x):
x+=1
S += 'R'
else:
for i in range(x-a):
x-=1
S += 'L'
if b-y>0:
for j in range(b-y):
... |
s054984798 | p03836 | u481165257 | 1491544483 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 616 | ef route(sx, sy, tx, ty):
dx = tx - sx
dy = ty - sy
dx2 = dx if dx >= 0 else -dx
dy2 = dy if dy >= 0 else -dy
buf = ""
for i in range(dx2):
if dx >= 0:
buf += "L"
else:
buf += "R"
for i in range(dy2):
if dy >= 0:
buf += "U"
... |
s762320037 | p03836 | u912359563 | 1489755916 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 435 | sx, sy, gx, gy = list(map(int, input().split()))
l = []
dx = gx - sx
dy = gy - sy
for i in range(dx):
l.append('R')
for i in range(dy):
l.append('U')
for i in range(dx):
l.append('L')
for i in range(dy):
l.append('D')
l.append('D')
for i in range(dx+1):
l.append('R')
for i in range(dy+1):
l.append('U')
l.append('... |
s182380244 | p03836 | u290326033 | 1483846747 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 496 | def col(a, x):
if x > a:
while x > a:
print("R")
a += 1
else:
while x < a:
print("L")
a -= 1
def row(b, y):
if y > b:
while y > b:
print("U")
a += 1
else:
while y < b:
print("D")
a -= 1
data = int(input().split... |
s137265164 | p03836 | u757184416 | 1483844299 | Python | Python (3.4.3) | py | Runtime Error | 23 | 3064 | 439 | ret=''
for i in range(tx-sx):
ret=ret+'U'
for i in range(ty-sy):
ret=ret+'R'
for i in range(tx-sx):
ret=ret+'D'
import sys
inp=sys.stdin.readline()
sx,sy,tx,ty=map(lambda x: int(x), inp.split(' '))
for i in range(ty-sy+1):
ret=ret+'L'
for i in range(tx-sx+1):
ret=ret+'U'
for i in range(ty-sy+1):
... |
s419611643 | p03836 | u237316771 | 1483842138 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 55 | "U" * h + "R" * (w + 1) + "D" * (h + 1) + "L" * (w + 1) |
s963096571 | p03837 | u070201429 | 1597932083 | Python | PyPy3 (7.3.0) | py | Runtime Error | 90 | 68876 | 1146 | def main():
from sys import stdin
def input():
return stdin.readline().strip()
n, m = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(m):
i, j, k = map(int, input().split())
i -= 1
j -= 1
tree[i].append((k, j))
tree[j].append((k... |
s977828810 | p03837 | u477320129 | 1597431919 | Python | Python (3.8.2) | py | Runtime Error | 390 | 41456 | 1092 | #!/usr/bin/env python3
import sys
def solve(N: int, M: int, a: "List[int]", b: "List[int]", c: "List[int]"):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
omat = csr_matrix((c, (a, b)), shape=(N+1, N+1), dtype=np.int32, directed=False)
... |
s954766818 | p03837 | u685983477 | 1595190415 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 68512 | 811 | import numpy as np
def warshall_floyd(d,n):
#d[i][j]: iからjへの最短距離
for k in range(n):
for i in range(n):
for j in range(n):
if(i!=j):
d[i][j] = min(d[i][j],d[i][k] + d[k][j])
return d
def main():
n,m=map(int, input().split())
edge = [[] for _ in... |
s479399022 | p03837 | u858742833 | 1592966079 | Python | Python (3.8.2) | py | Runtime Error | 106 | 9500 | 864 | import heapq
def main():
N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
a, b, c = map(int, input().split())
G[a - 1].append((b - 1, c))
G[b - 1].append((a - 1, c))
used = set()
for i in range(N):
H = []
for b, c in G[i]:
... |
s604703279 | p03837 | u127499732 | 1592855687 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9400 | 1006 | import heapq
def dijkstra(n, s, g):
h = [(0, s)]
heapq.heapify(h)
cost = [float("Inf")] * (n + 1) # cost: i -> j
cost[s] = 0
while h:
c, v = heapq.heappop(h)
if c > cost[v]:
continue
for d, u in g[v]:
d_s_u = d + cost[v]
if d_s_u < cost... |
s863134321 | p03837 | u677121387 | 1592589539 | Python | Python (3.8.2) | py | Runtime Error | 28 | 9352 | 484 | n,m = map(int,input().split())
INF = 10**18
d = [[INF]*n for _ in range(n)]
for i in range(n): d[i][i] = 0
a = [0]*m
b = [0]*m
c = [0]*m
for i in range(m):
a,b,c = map(int,input().split())
a -= 1
b -= 1
a[i] = a
b[i] = b
c[i] = c
d[a][b] = c
d[b][a] = c
for k in range(n):
for i in r... |
s534380098 | p03837 | u169350228 | 1591587789 | Python | Python (3.4.3) | py | Runtime Error | 249 | 17408 | 875 | import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
def main():
n,m = map(int,ipt().split())
... |
s877397987 | p03837 | u762540523 | 1591296634 | Python | Python (3.4.3) | py | Runtime Error | 361 | 25572 | 1174 | def resolve():
from scipy.sparse.csgraph import shortest_path
import scipy
import numpy as numpy
n, m = map(int, input().split())
row = [None] * m
col = row[:]
data = row[:]
for i in range(m):
row[i], col[i], data[i] = map(int, input().split())
row[i] -= 1
col[i] ... |
s767656457 | p03837 | u591808161 | 1590869951 | Python | PyPy3 (2.4.0) | py | Runtime Error | 207 | 39280 | 968 | import sys
sys.setrecursionlimit(1000001)
def main():
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = [None] * (m-1)
b = [None] * (m-1)
c = [Non... |
s333370424 | p03837 | u591808161 | 1590868051 | Python | Python (3.4.3) | py | Runtime Error | 579 | 3428 | 766 | import sys
sys.setrecursionlimit(1000001)
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
... |
s943443315 | p03837 | u591808161 | 1590868012 | Python | Python (3.4.3) | py | Runtime Error | 589 | 4176 | 819 | import sys
sys.setrecursionlimit(1000001)
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
... |
s738974439 | p03837 | u591808161 | 1590867839 | Python | Python (3.4.3) | py | Runtime Error | 604 | 3476 | 723 | import sys
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = min(dist[x-1]... |
s940834752 | p03837 | u591808161 | 1590867771 | Python | PyPy3 (2.4.0) | py | Runtime Error | 253 | 42348 | 723 | import sys
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = min(dist[x-1]... |
s235793004 | p03837 | u591808161 | 1590867682 | Python | PyPy3 (2.4.0) | py | Runtime Error | 249 | 42716 | 734 | import sys
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = min(dist[x-1]... |
s102749735 | p03837 | u591808161 | 1590820764 | Python | PyPy3 (2.4.0) | py | Runtime Error | 254 | 42348 | 724 | import sys
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(1, n):
for j in range(1, n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = min(dis... |
s864394271 | p03837 | u591808161 | 1590819506 | Python | PyPy3 (2.4.0) | py | Runtime Error | 232 | 41836 | 723 | import sys
n, m = map(int, input().rstrip().split())
dist = [[500000 for i in range(n)]for j in range(n)]
for i in range(1, n):
for j in range(1, n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = min(dis... |
s526490998 | p03837 | u591808161 | 1590819380 | Python | Python (3.4.3) | py | Runtime Error | 596 | 3648 | 729 | import sys
n, m = map(int, input().rstrip().split())
dist = [[float('inf') for i in range(n)]for j in range(n)]
for i in range(1, n):
for j in range(1, n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
dist[x-1][y-1] = m... |
s283978455 | p03837 | u591808161 | 1590728768 | Python | PyPy3 (2.4.0) | py | Runtime Error | 272 | 44268 | 752 | import sys
import re
import heapq
n, m = map(int, input().rstrip().split())
dist = [[float('inf') for i in range(n)]for j in range(n)]
for i in range(1, n):
for j in range(1, n):
if (i==j):
dist[i][j]=0
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
... |
s925330395 | p03837 | u318127926 | 1590718625 | Python | Python (3.4.3) | py | Runtime Error | 1076 | 93148 | 874 | import sys
sys.setrecursionlimit(10**5)
n, m = map(int, input().split())
INF = 10**10
d = [[INF]*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
nxt = [[[i] for i in range(n)] for _ in range(n)]
for k in range(n):
for i in range(n):
for... |
s262294743 | p03837 | u318127926 | 1590718549 | Python | Python (3.4.3) | py | Runtime Error | 843 | 5436 | 834 | n, m = map(int, input().split())
INF = 10**10
d = [[INF]*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
nxt = [[[i] for i in range(n)] for _ in range(n)]
for k in range(n):
for i in range(n):
for j in range(n):
if i==j:
... |
s535182593 | p03837 | u197457087 | 1590717587 | Python | PyPy3 (2.4.0) | py | Runtime Error | 282 | 44780 | 698 | N,M = map(int,input().split())
INF = float("inf")
load = [[[INF, 0] for _ in range(N)] for _ in range(N)]
#print(load)
#dis = [[] for _ in range(N)]
#ID = [0 for _ in range(M)] #、0は未使用、1は使用
for i in range(M):
a,b,c = map(int,input().split())
a-=1;b-=1
load[a][b] = [c,0]
load[b][a] = [c,0]
#dis[a].append([b,i]... |
s775981771 | p03837 | u591808161 | 1590557109 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38384 | 714 | import sys
import re
import heapq
n, m = map(int, input().rstrip().split())
for i in range(n):
for j in range(n):
if (i==j):
dist[i][j]=0
else:
dist[i][j]=float('inf')
a = []
b = []
c = []
for i in range(m):
x, y, z = map(int, input().rstrip().split())
di... |
s818648667 | p03837 | u836004075 | 1590541195 | Python | Python (3.4.3) | py | Runtime Error | 109 | 11252 | 1281 | import heapq
n, m = map( int, input().split() )
adj_list = [ [] for i in range( n+1 ) ]
for _ in range( m ):
a, b, c = map( int, input().split() )
adj_list[ a ].append( ( b, c ) )
adj_list[ b ].append( ( a, c ) )
# dijkstra
def dijkstra( start ):
prev_node = [ -1 ] * ( n + 1 )
INF = 10 ** 10
VI... |
s794074746 | p03837 | u836004075 | 1590541100 | Python | Python (3.4.3) | py | Runtime Error | 45 | 11124 | 1281 | import heapq
n, m = map( int, input().split() )
adj_list = [ [] for i in range( n+1 ) ]
for _ in range( m ):
a, b, c = map( int, input().split() )
adj_list[ a ].append( ( b, c ) )
adj_list[ b ].append( ( a, c ) )
# dijkstra
def dijkstra( start ):
prev_node = [ -1 ] * ( n + 1 )
INF = 10 ** 10
VI... |
s783598936 | p03837 | u836004075 | 1590540967 | Python | Python (3.4.3) | py | Runtime Error | 32 | 3316 | 1284 | import heapq
n, m = map( int, input().split() )
adj_list = [ [] for i in range( 0, n+1 ) ]
for _ in range( m ):
a, b, c = map( int, input().split() )
adj_list[ a ].append( ( b, c ) )
adj_list[ b ].append( ( a, c ) )
# dijkstra
def dijkstra( start ):
prev_node = [ -1 ] * ( n + 1 )
INF = 10 ** 10
... |
s887722392 | p03837 | u446774692 | 1590539827 | Python | Python (3.4.3) | py | Runtime Error | 25 | 3564 | 741 | N,M = map(int,input().split())
from collections import deque
v = [deque([]) for _ in range(N)]
for i in range(M):
a,b,c = map(int,input().split())
a,b = a-1,b-1
v[a].append([b,c])
v[b].append([a,c])
import math
s = deque([])
for i in range(N):
ls = [[-1,math.inf]]*N
ls[i] = [-1,0]
q = [de... |
s091573843 | p03837 | u679520304 | 1590070173 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 499 | N,M = map(int,input().split())
start = []
goal = []
data = []
for _ in range(M):
a,b,c = map(int,input().split())
start.append(a)
goal.append(b)
data.append(c)
csr = csr_matrix((data,(start,goal)),shape=(N+1,N+1))
p,q = floyd_warshall(csr,directed=False,return_predecessors=True)
d=[[True]*N for _ in ran... |
s699886861 | p03837 | u132687480 | 1589888052 | Python | Python (3.4.3) | py | Runtime Error | 521 | 3700 | 1395 | N, M = map(int, input().split())
A = [0]*M
B = [0]*M
C = [0]*M
for i in range(M):
A[i], B[i], C[i] = map(int, input().split())
import heapq
def dijkstra(graph, start, goal):
path = [start]
score = 0
searching_heap = []
checked = {start: score}
heapq.heappush(searching_heap, (score, path))
... |
s434949834 | p03837 | u977193988 | 1588886513 | Python | PyPy3 (2.4.0) | py | Runtime Error | 213 | 40560 | 1130 | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(20000000)
def main():
N, M = map(int, input().split())
S = []
d = [[float("inf")] * N for _ in range(N)]
L = []
for i in range(M):
a, b, c = map(int, input().split())
d[a - 1][b - 1] = c
... |
s286808398 | p03837 | u572343785 | 1588045483 | Python | Python (3.4.3) | py | Runtime Error | 580 | 3188 | 489 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
a[i],b[i],c[i] = map(int,input().split())
d = [[0]*N for i in range(N)]
for i in range(M):
d[a[i]-1][b[i]-1] = c[i]
d[b[i]-1][a[i]-1] = c[i]
for i in range(N):
for j in range(N):
for s in range(N):
... |
s692959447 | p03837 | u572343785 | 1588045290 | Python | Python (3.4.3) | py | Runtime Error | 559 | 3188 | 488 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
a[i],b[i],c[i] = map(int,input().split())
d = [[0]*N for i in range(N)]
for i in range(M):
d[a[i]-1][b[i]-1] = c[i]
d[b[i]-1][a[i]-1] = c[i]
for s in range(N):
for i in range(N):
for j in range(N):
... |
s235072922 | p03837 | u572343785 | 1588045064 | Python | Python (3.4.3) | py | Runtime Error | 559 | 3188 | 510 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
a[i],b[i],c[i] = map(int,input().split())
d = [[0]*N for i in range(N)]
for i in range(M):
d[a[i]-1][b[i]-1] = c[i]
d[b[i]-1][a[i]-1] = c[i]
for s in range(N):
for i in range(N):
for j in range(N):
... |
s328902467 | p03837 | u572343785 | 1588044855 | Python | Python (3.4.3) | py | Runtime Error | 582 | 3188 | 490 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
a[i],b[i],c[i] = map(int,input().split())
d = [[0]*N for i in range(N)]
for i in range(M):
d[a[i]-1][b[i]-1] = c[i]
d[b[i]-1][a[i]-1] = c[i]
for s in range(N):
for i in range(N):
for j in range(N):
... |
s530318420 | p03837 | u572343785 | 1588044632 | Python | Python (3.4.3) | py | Runtime Error | 554 | 3188 | 490 | N,M = map(int,input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
a[i],b[i],c[i] = map(int,input().split())
d = [[0]*N for i in range(N)]
for i in range(M):
d[a[i]-1][b[i]-1] = c[i]
d[b[i]-1][a[i]-1] = c[i]
for s in range(M):
for i in range(N):
for j in range(N):
... |
s654139403 | p03837 | u843135954 | 1587010738 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38740 | 1504 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
class WarshallFloyd():
def __init__(self, N):
self.N = N
self.d = [[float("inf") ... |
s791976457 | p03837 | u107601154 | 1586728512 | Python | Python (3.4.3) | py | Runtime Error | 517 | 3608 | 765 | N,M = (int(x) for x in input().split())
a= [0]*1000
b = [0]*1000
c = [0]*1000
dist= [[0]*100 for i in range(100)]
for i in range(M):
a[i],b[i],c[i] = (int(x) for x in input().split())
for i in range(N):
for j in range(N):
if(i==j):
dist[i][j] = 0
else:dist[i][j] = float('inf')
for i... |
s072272859 | p03837 | u139112865 | 1586311290 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 703 | #051_D
from heapq import heappop, heappush
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
d[i][i] = 0
n, m = map(int, input().split())
edges = []
for _ in range(m):
a, b, c = map(int, input().split())
d[a-1][b-1] = c
d[b-1][a-1] = c
edges.append((a-1, b-1))
def wa... |
s844193191 | p03837 | u780962115 | 1584826724 | Python | Python (3.4.3) | py | Runtime Error | 434 | 3700 | 954 | # cadidates of no shortest paths
n, m = map(int, input().split())
d = [[float("inf") for i in range(n + 1)] for i in range(n + 1)]
edge_data=[]
connect={i:[] for i in range(1,n+1)}
for i in range(m):
x, y, z = map(int, input().split())
# 有向グラフか無向グラフかによってここで場合わけが生じる
d[x][y] = z
d[y][x] = z
connect[x... |
s362857552 | p03837 | u059940903 | 1584084889 | Python | PyPy3 (2.4.0) | py | Runtime Error | 250 | 43372 | 514 | from copy import deepcopy
N, M = map(int, input().split())
graph = [[10000 for _ in range(N)] for l in range(N)]
for i in range(M):
a, b, c = map(int, input().split())
a -= 1
b -= 1
graph[b][a] = c
graph[a][b] = c
newGraph = deepcopy(graph)
for k in range(N):
for i in range(N):
for j in range(N):
... |
s922623666 | p03837 | u964299793 | 1583809414 | Python | Python (3.4.3) | py | Runtime Error | 644 | 3380 | 633 | import sys
input=sys.stdin.readline
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(m):
a[i],b[i],c[i]=map(int,input().split())
a[i]-=1
b[i]-=1
INF=float('inf')
dist=[ [INF]*n for _ in range(n)]
for i in range(n):
dist[i][i]=0
for i in range(m):
dist[a[i]][b[i]]=c[i]
dist[b[i]][a[i]]=c[i... |
s275444833 | p03837 | u964299793 | 1583809088 | Python | Python (3.4.3) | py | Runtime Error | 560 | 3380 | 597 | n,m=map(int,input().split())
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(m):
a[i],b[i],c[i]=map(int,input().split())
a[i]-=1
b[i]-=1
INF=float('inf')
dist=[ [INF]*n for _ in range(n)]
for i in range(n):
dist[i][i]=0
for i in range(m):
dist[a[i]][b[i]]=c[i]
dist[b[i]][a[i]]=c[i]
#floyd warshall
for k in range(n):... |
s004702084 | p03837 | u223904637 | 1583193693 | Python | PyPy3 (2.4.0) | py | Runtime Error | 200 | 39280 | 604 | import heapq
n,m=map(int,input().split())
g=[[] for i in range(n)]
p=[]
for i in range(m):
a,b,c=map(int,input().split())
a-=1
b-=1
p.append([a,b,c])
g[a].append([c,b])
g[b].append([c,a])
ans=0
for i in range(m):
s=p[i][0]
goal=p[i][1]
c=p[i][2]
q=[]
heapq.heappush(q,[0,s])
... |
s057785619 | p03837 | u368796742 | 1582406591 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3828 | 1227 | import sys
input = sys.stdin.readline
from collections import deque
import copy
n,m = map(int,input().split())
r = [[] for i in range(n)]
for i in range(m):
a,b,c = map(int,input().split())
r[a-1].append((b-1,c,i+1))
r[b-1].append((a-1,c,i+1))
def bfs(x,y):
q = deque([])
l = [-1]*n
l[x] = 0
... |
s204905302 | p03837 | u326552320 | 1582268742 | Python | Python (3.4.3) | py | Runtime Error | 152 | 12420 | 1520 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: D_fix
# CreatedDate: 2020-02-21 01:20:19 +0900
# LastModified: 2020-02-21 02:04:42 +0900
#
import os
import sys
import numpy as np
import pandas as pd
def make_matrix(matrix,a,b,c):
matrix[a-1][b-1] = c
matrix[b-1][a-1] = c
def initial_signal(i,mat... |
s240412850 | p03837 | u808806124 | 1581756176 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 448 | n, m = map(int, input().split())
d = np.ones((n, n)) * 1001
es = []
for i in range(m):
es.append(list(map(int, input().split())))
for (i, j, w) in es:
d[i - 1][j - 1] = w
d[j - 1][i - 1] = w
for k in range(n):
for i in range(n):
for j in range(n):
l = d[i][k] + d[k][j]
... |
s792520521 | p03837 | u476604182 | 1581741161 | Python | PyPy3 (2.4.0) | py | Runtime Error | 320 | 45148 | 659 | from collections import defaultdict
from heapq import heappush, heappop
N, M = map(int, input().split())
dic = defaultdict(list)
Els = []
for i in range(M):
a, b, c = map(int, input().split())
dic[a-1] += [(b-1,c)]
dic[b-1] += [(a-1, c)]
Els += [(a,b,c)]
def dijkstra(s,e):
dist = [float('inf')]*N
dist[s] =... |
s140792643 | p03837 | u311379832 | 1581292459 | Python | Python (3.4.3) | py | Runtime Error | 376 | 24788 | 549 | from scipy.sparse.csgraph import dijkstra
INF = 10 ** 18
N, M = map(int, input().split())
d = [[INF for _ in range(N)] for _ in range(N)]
abc = []
for i in range(M):
a, b, c = map(int, input().split())
abc.append([a - 1, b - 1, c])
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
dtra = dijkstra(d)
minlst = [... |
s764392572 | p03837 | u311379832 | 1581292446 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38516 | 549 | from scipy.sparse.csgraph import dijkstra
INF = 10 ** 18
N, M = map(int, input().split())
d = [[INF for _ in range(N)] for _ in range(N)]
abc = []
for i in range(M):
a, b, c = map(int, input().split())
abc.append([a - 1, b - 1, c])
d[a - 1][b - 1] = c
d[b - 1][a - 1] = c
dtra = dijkstra(d)
minlst = [... |
s361851437 | p03837 | u342869120 | 1581100906 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 739 | import copy
N, M = map(int, input().split())
dp = [[float('inf')]*N for _ in range(N)]
for i in range(N):
dp[i][i] = 0
for i in range(M):
a, b, c = map(int, input().split())
dp[a-1][b-1] = c
dp[b-1][a-1] = c
g = copy.deepcopy(dp)
# ワーシャルフロイド
for k in range(N):
for i in range(N):
for j in... |
s002849271 | p03837 | u342869120 | 1581100882 | Python | PyPy3 (2.4.0) | py | Runtime Error | 167 | 38384 | 734 | import copy
N, M = map(int, input().split())
dp = [[float('inf')]*N for _ in range(N)]
for i in range(N):
dp[i][i] = 0
for i in range(M):
a, b, c = map(int, input().split())
dp[a-1][b-1] = c
dp[b-1][a-1] = c
g = copy.deepcopy(dp)
# ワーシャルフロイド
for k in range(N):
for i in range(N):
for j in... |
s303840888 | p03837 | u905582793 | 1580711895 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38384 | 684 | from itertools import combinations
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
abc = [list(map(int,input().split())) for i in range(m)]
abc = [[abc[i][0]-1,abc[i][1]-1,abc[i][2]] for i in range(m)]
graph = [[] f... |
s955247638 | p03837 | u373958718 | 1579020981 | Python | Python (3.4.3) | py | Runtime Error | 546 | 3316 | 561 | n,m=map(int,input().split())
l=[list(map(int,input().split()))for i in range(m)]
dist=[[1<<29]*n for i in range(n)]
for i in range(m): dist[i][i]=0
for a in l:
dist[a[0]-1][a[1]-1] = min(dist[a[0]-1][a[1]-1],a[2])
dist[a[1]-1][a[0]-1] = min(dist[a[1]-1][a[0]-1],a[2])
# print(dist)
for k in range(n):
for i in rang... |
s035128439 | p03837 | u373958718 | 1579020821 | Python | Python (3.4.3) | py | Runtime Error | 570 | 3316 | 547 | n,m=map(int,input().split())
l=[list(map(int,input().split()))for i in range(m)]
dist=[[1<<29]*n for i in range(n)]
for i in range(m): dist[i][i]=0
for a in l:
dist[a[0]-1][a[1]-1] = min(dist[a[0]-1][a[1]-1],a[2])
dist[a[1]-1][a[0]-1] = min(dist[a[1]-1][a[0]-1],a[2])
for k in range(n):
for i in range(n):
for ... |
s215460291 | p03837 | u594244257 | 1578508568 | Python | Python (3.4.3) | py | Runtime Error | 234 | 3572 | 974 | MAX_D = 10**9
def solve():
N,M = map(int, input().split())
d = [[MAX_D]*N for _ in range(N)]
edges = [[False]*N for _ in range(N)]
base_edge = {}
for _ in range(M):
a,b,c = map(int, input().split())
edges[a-1][b-1] = True
edges[b-1][a-1] = True
d[a-1][b-1] = c
... |
s586855957 | p03837 | u940139461 | 1577391260 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 874 | N, M = map(int, input().split())
graph = [[float('infinity') for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
a, b, c = map(int, input().split())
graph[a][b] = c
graph[b][c] = c
ans = 0
# 頂点g -> 頂点vへのコストを計算する。直接のpathが最小なら、カウントしない。
# そうでなければ、他の経路があるので、カウントする。
for g in range(1, len(graph)):
... |
s161860862 | p03837 | u945181840 | 1576346116 | Python | Python (3.4.3) | py | Runtime Error | 1695 | 29068 | 599 | import sys
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
from itertools import combinations
read = sys.stdin.read
N, M, *abc = map(int, read().split())
a, b, c = zip(*zip(*[iter(abc)] * 3))
graph = csr_matrix((c, (a, b)), shape=(N + 1, N + 1))
distance = shortest_path(graph, direc... |
s264448894 | p03837 | u698919163 | 1575173308 | Python | Python (3.4.3) | py | Runtime Error | 640 | 3316 | 598 | N,M = list(map(int,input().split()))
abc = []
abc = [list(map(int,input().split())) for i in range(M)]
A=[]
B=[]
C=[]
dist=[[1000]*N for i in range(N)]
for i in range(M):
A.append(abc[i][0])
B.append(abc[i][1])
C.append(abc[i][2])
for i in range(N):
dist[A[i]-1][B[i]-1] = C[i]
dist[B[i]-1][A[... |
s568730123 | p03837 | u879870653 | 1574178261 | Python | Python (3.4.3) | py | Runtime Error | 176 | 13952 | 528 | import sys
input = sys.stdin.readline
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n,m = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(m) :
a, b, c = map(int,input().split())
A[i] = a-1
B[i] = b-1
C[i] = c
graph = [[0]*n for i in range(n)]
for i in range(m) :
... |
s721488595 | p03837 | u879870653 | 1574178232 | Python | Python (3.4.3) | py | Runtime Error | 257 | 17048 | 490 | from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
n,m = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(m) :
a, b, c = map(int,input().split())
A[i] = a-1
B[i] = b-1
C[i] = c
graph = [[0]*n for i in range(n)]
for i in range(m) :
graph[A[i]][B[i]] = C[i]
graph... |
s121206863 | p03837 | u879870653 | 1574131658 | Python | Python (3.4.3) | py | Runtime Error | 243 | 17188 | 595 | from scipy.sparse.csgraph import dijkstra
n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[None]*n for i in range(n)]
for a, b, c in edges :
graph[a-1][b-1] = c
#graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=True).astype(int)
used = [0]*m
... |
s522827234 | p03837 | u879870653 | 1574130446 | Python | Python (3.4.3) | py | Runtime Error | 303 | 17952 | 585 | from scipy.sparse.csgraph import *
n,m = map(int,input().split())
edges = [[int(x) for x in input().split()] for i in range(m)]
graph = [[0]*n for i in range(n)]
for a, b, c in edges :
graph[a-1][b-1] = c
graph = csgraph_from_dense(graph)
dist = dijkstra(graph, directed=False).astype(int)
used = [0]*m
for s in r... |
s997243731 | p03837 | u638795007 | 1573428427 | Python | Python (3.4.3) | py | Runtime Error | 35 | 3956 | 941 | def examD():
N, M = LI()
D = [[float("inf") for i in range(N)] for i in range(N)]
# d[u][v] : 辺uvのコスト(存在しないときはinf)
XY = [[0,0]]*M
for i in range(M):
x, y, z = map(int, input().split())
XY[i] = [x-1,y-1]
D[x - 1][y - 1] = z
D[y - 1][x - 1] = z
for i in range(N):
... |
s051420292 | p03837 | u562935282 | 1572584182 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38256 | 819 | from heapq import heappop, heappush
from math import inf
def dijkstra_need_edge(s):
used = [False] * n
used[s] = True
dist = [inf] * n
dist[s] = 0
hq = []
for e in g[s]:
heappush(hq, e)
need_edge = set()
while hq:
w, t, ind = heappop(hq)
if used[t]: continue
... |
s194249502 | p03837 | u564837886 | 1571806794 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 176 | sx, sy, tx, ty = map(int, input().split())
X, Y = tx-sx, ty-sy
ans = 'R'*X + 'U'*Y + 'L'*X + 'D'*Y + 'D' + 'R'*(X+1) + 'U'*(Y+1) + 'LU' + 'L'*(X+1) + 'D'*(Y+1) + 'R'
print(ans) |
s349011426 | p03837 | u118642796 | 1571447564 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38256 | 407 | N,M=map(int,input().split())
INF = 10**5
D=[[INF]*N for _ in range(N)]
for i in range(N):
D[i][i]=0
path=[]
for i in range(M):
a,b,c = map(int,input().split())
D[a][b]=c
D[b][a]=c
path.append([a,b,c])
for k in range(N):
for i in range(N-1):
for j in range(i+1,N):
D[i][j]=min(D[i][j],D[i][k]+D[j][k... |
s675486617 | p03837 | u437727817 | 1570310027 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 452 | n,m = map(int,input().split())
dist = []
a = []
b = []
c = []
for i in range(m):
a[i], b[i], c[i] = map(int,input().split())
dist[a[i]-1][b[i]-1] = c[i]
dist[b[i]-1][a[i]-1] = c[i]
#nは頂点、mは辺、a、bは頂点、cはaとbの距離
for i in range(n):
for j in range(n):
for k in range(n):
dist[i][j] = min(dist[i][j], dist[i][k] +... |
s393703925 | p03837 | u924374652 | 1570067745 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 1108 | import heapq
def dijkstra(graph, node, start):
INF = float("inf")
dist = [INF] * node
dist[start] = 0
que = [(0, start)]
while que:
cost, one_node = heapq.heappop(heap)
for next_c, next_n in graph[one_node]:
dist_candi = dist[one_node] + next_c
if dist_candi < dist[next_n]:
dist[n... |
s958460238 | p03837 | u714378447 | 1568667937 | Python | PyPy3 (2.4.0) | py | Runtime Error | 173 | 38384 | 781 | from queue import Queue
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
a,b,c=map(int,input().split())
G[a-1].append([b-1,c])
G[b-1].append([a-1,c])
T=[[1000]*N for i in range(N)]
U=[[[]for i in range(N)] for i in range(N)]
for i in range(N):
q=Queue()
seen=[False]*N
q.put([i,0,[i]])
... |
s017815943 | p03837 | u499381410 | 1568572024 | Python | PyPy3 (2.4.0) | py | Runtime Error | 203 | 38896 | 1444 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functoo... |
s180417784 | p03837 | u673361376 | 1567040924 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3692 | 1265 | from collections import defaultdict, deque
def solve(graph, edges, n, start_idx):
flg = [False for _ in range(n)] #未検索のノードはFlase
flg[start_idx] = True
cost = [float('inf') for _ in range(n)]
cost[start_idx] = 0
prv_edges = [None for _ in range(n)]
prv_node = start_idx
while not all(flg):
f... |
s269822174 | p03837 | u820047642 | 1567023356 | Python | PyPy3 (2.4.0) | py | Runtime Error | 185 | 38480 | 1176 | import heapq,math,sys
input=sys.stdin.readline
INF=math.inf
heappush=heapq.heappush
heappop=heapq.heappop
n,m=map(int,input().split())
graph=[[] for _ in range(n)]
minway=[]
bridges=[]
ans=0
for _ in range(m):
a,b,c=map(int,input().split())
graph[a-1].append((b-1,c))
graph[b-1].append((a-1,c))
bridges.... |
s552136193 | p03837 | u484229314 | 1565648137 | Python | PyPy3 (2.4.0) | py | Runtime Error | 254 | 42604 | 747 | N, M = [int(_) for _ in input().split()]
INF = 10 ** 10
costs = [[INF] * 101 for _ in range(101)]
for i in range(N + 1):
costs[i][i] = 0
paths = []
for i in range(M):
a, b, c = [int(_) for _ in input().split()]
costs[a][b] = c
costs[b][a] = c
paths.append((a, b, c))
for k in range(N + 1):
for ... |
s381793332 | p03837 | u813102292 | 1563587641 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 721 | N, M = map(int, input().split())
INF = 10**9
edges = []
for i in range(M):
edges.append(list(map(int, input().split())))
dist = [[INF for j in range(N)] for i in range(N)]
for i in range(N):
dist[i][i] = 0
for i in range(M):
a, b, c = edges[i]
a, b = a - 1, b - 1
dist[a][b] = c[i]
dist[b][a... |
s390080903 | p03837 | u813102292 | 1563587535 | Python | Python (3.4.3) | py | Runtime Error | 21 | 3316 | 700 | N, M = map(int, input().split())
INF = 10**9
edges = []
for i in range(M):
edges.append(list(map(int, input().split())))
dist = [[INF for j in range(N)] for i in range(N)]
for i in range(N):
dist[i][i] = 0
for i in range(M):
a, b, c = edges[i]
a, b = a - 1, b - 1
dist[a][b] = c[i]
dist[b][a... |
s410440370 | p03837 | u144980750 | 1562685634 | Python | PyPy3 (2.4.0) | py | Runtime Error | 184 | 39792 | 230 | s=input()
k=int(input())
ans=[]
for i in range(len(s)):
for j in range(i+1,len(s)+1):
ans.append(s[i:j])
ans.sort()
a=[ans[0]]
for i in range(1,len(ans)):
if ans[i-1]!=ans[i]:
a.append(ans[i])
print(a[k-1]) |
s179824173 | p03837 | u731028462 | 1562185296 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 658 | g = Graph()
N,M = list(map(int, input().split()))
INF = 10**9+7
A = [[INF if i!=j else 0 for i in range(N)] for j in range(N)]
S=[]
E=[]
W=[]
for i in range(M):
s,e,w=list(map(int,input().split()))
g.add_edge(s-1, e-1, w)
g.add_edge(e-1, s-1, w)
S.append(s-1)
E.append(e-1)
W.append(w)
for i in... |
s878106621 | p03837 | u900045983 | 1562126246 | Python | Python (3.4.3) | py | Runtime Error | 154 | 12500 | 1365 | import numpy as np
import copy
from collections import defaultdict
from heapq import heappush, heappop
def djkstra(adj_mat, src):
dist = defaultdict(lambda: np.inf)
dist[src] = 0
prev = defaultdict(lambda: None)
queue = []
heappush(queue, (dist[src], src))
while len(queue) > 0:
dist... |
s179398374 | p03837 | u655834330 | 1561948206 | Python | PyPy3 (2.4.0) | py | Runtime Error | 286 | 45020 | 1327 |
def warshall_floyd(d, n):
# 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])
return d
def read_input():
n, m = map(int, input().split())
edges = []
for i in range(m):
a, b, c = ... |
s827938268 | p03837 | u838644735 | 1561696644 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2112 | 134536 | 3002 | N, M = map(int, input().split())
ABC = []
for i in range(M):
abc = tuple(map(int, input().split()))
ABC.append(abc)
# print(N, M, ABC)
max_len = 0
for abc in ABC:
max_len += abc[2]
def sub(a, b, d, d_min, ABC, path):
# print('sub', a, b, d, d_min, ABC, path)
for abc in ABC:
# print('sub',... |
s478976455 | p03837 | u365364616 | 1558471385 | Python | Python (3.4.3) | py | Runtime Error | 235 | 6740 | 1134 | import copy
def warshall_floyd(V, E):
INF = 10 ** 9
d = [[[INF, []] for j in range(V + 1)] for i in range(V + 1)]
for i, j, c in E:
d[i][j] = [c, []]
d[j][i] = [c, []]
for k in range(1, V + 1):
for i in range(1, V):
for j in range(i, V + 1):
dk = d[i]... |
s543285252 | p03837 | u167751176 | 1556750468 | Python | Python (3.4.3) | py | Runtime Error | 1079 | 3828 | 928 | def main():
N, M = map(int, input().split())
points = [[] for _ in range(N+1)]
for i in range(1, M+1):
a, b, c = map(int, input().split())
points[a].append([b, c, i])
points[b].append([a, c, i])
use = set()
def dijksta(start):
is_visited = [False]*(N+1)
is_visited[0] = True
is_visited[start] = True
s... |
s241414194 | p03837 | u167751176 | 1556750381 | Python | Python (3.4.3) | py | Runtime Error | 1099 | 3828 | 958 | def main():
N, M = map(int, input().split())
points = [[] for _ in range(N+1)]
for i in range(1, M+1):
a, b, c = map(int, input().split())
points[a].append([b, c, i])
points[b].append([a, c, i])
use = set()
def dijksta(start):
is_visited = [False]*(N+1)
is_visited[0] = True
is_visited[start] = True
s... |
s587249863 | p03837 | u167751176 | 1556750213 | Python | Python (3.4.3) | py | Runtime Error | 31 | 3316 | 956 | def main():
N, M = map(int, input().split())
points = [[] for _ in range(N+1)]
for i in range(1, M+1):
a, b, c = map(int, input().split())
points[a].append([b, c, i])
points[b].append([a, c, i])
is_visited = [False]*(N+1)
is_visited[0] = True
use = set()
def dijksta(start):
is_visited[start] = True
sta... |
s761234637 | p03837 | u789339072 | 1556313719 | Python | Python (3.4.3) | py | Runtime Error | 1377 | 14408 | 587 | import sys
import numpy as np
input = sys.stdin.readline
N, M = map(int, input().split())
a = [0]*N
b = [0]*N
c = [0]*N
for i in range(M):
a[i], b[i], c[i] = map(int, input().split())
a[i] -=1
b[i] -=1
MAX = 10**10
dist = np.zeros((N,N))
dist += MAX
for i in range(N):
dist[i,i] = 0
for i in range(M)... |
s056354177 | p03837 | u789339072 | 1556312960 | Python | PyPy3 (2.4.0) | py | Runtime Error | 201 | 41580 | 601 | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = [0]*N
b = [0]*N
c = [0]*N
for i in range(M):
a[i], b[i], c[i] = map(int, input().split())
a[i] -=1
b[i] -=1
MAX = 10**10
dist = [[MAX for j in range(N)] for i in range(N)]
for i in range(N):
dist[i][i] = 0
for i in range(M):
... |
s243809870 | p03837 | u794250528 | 1556159218 | Python | Python (3.4.3) | py | Runtime Error | 1506 | 3444 | 722 | import itertools
n, m = map(int, input().split())
a = [None] * n
b = [None] * n
c = [None] * n
for i in range(m):
a[i], b[i], c[i] = map(int, input().split())
a[i] -= 1
b[i] -= 1
wf = [[float('inf')] * n for _ in range(n)]
for i in range(n):
wf[i][i] = 0
for i in range(m):
wf[a[i]][b[i]] = wf[b[... |
s393145895 | p03837 | u151625340 | 1555885846 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38384 | 3976 | class Dijkstra: # 最短経路問題
def __init__(self, route_map, start_point, goal_point=None):
self.route_map = route_map #
self.start_point = start_point # スタート位置
self.goal_point = goal_point
def execute(self):
import heapq
num_of_city = len(self.route_map) # ノード数
dist =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.