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
s565608444
p03546
u992910889
1588128243
Python
PyPy3 (2.4.0)
py
Runtime Error
185
38384
1273
# import bisect # from collections import Counter, deque # https://note.nkmk.me/python-scipy-connected-components/ # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement...
s010753095
p03546
u992910889
1588127989
Python
Python (3.4.3)
py
Runtime Error
20
3064
1959
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # 最短経路問題で使われるアルゴリズムの1つ。 # グラフ上の全ての頂点間の最短経路を探す # 負の閉路(辺の重みの和が負になるような閉路)がない限り、負の辺があっても使える。 # 負の閉路を持つ場合は'NEGATIVE CYCLE'を、そうでない場合には(i,j)成分に # 頂点iから頂点jへの最短経路の距離を格納するdist_listをprintする関数 ...
s708542907
p03546
u992910889
1588127167
Python
Python (3.4.3)
py
Runtime Error
244
17668
756
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import floyd_warshall import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): H, W = map(int, input().split()) graph = [[i for i in list(map(int, input().split()))] for _ in range(10)] ...
s877107829
p03546
u992910889
1588127126
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38384
753
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import floyd_warshall import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): H, W = map(int, input().split()) graph = [[i for i in list(map(int, input().split()))] for _ in range(10)] g...
s332255688
p03546
u992910889
1588126108
Python
PyPy3 (2.4.0)
py
Runtime Error
191
39152
2413
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # 最短経路問題で使われるアルゴリズムの1つ。 # グラフ上の全ての頂点間の最短経路を探す # 負の閉路(辺の重みの和が負になるような閉路)がない限り、負の辺があっても使える。 # 負の閉路を持つ場合は'NEGATIVE CYCLE'を、そうでない場合には(i,j)成分に # 頂点iから頂点jへの最短経路の距離を格納するdist_listをprintする関数 ...
s585771482
p03546
u992910889
1588126074
Python
Python (3.4.3)
py
Runtime Error
21
3180
2499
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # 最短経路問題で使われるアルゴリズムの1つ。 # グラフ上の全ての頂点間の最短経路を探す # 負の閉路(辺の重みの和が負になるような閉路)がない限り、負の辺があっても使える。 # 負の閉路を持つ場合は'NEGATIVE CYCLE'を、そうでない場合には(i,j)成分に # 頂点iから頂点jへの最短経路の距離を格納するdist_listをprintする関数 ...
s739854400
p03546
u992910889
1588126041
Python
PyPy3 (2.4.0)
py
Runtime Error
175
39024
2499
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): # 最短経路問題で使われるアルゴリズムの1つ。 # グラフ上の全ての頂点間の最短経路を探す # 負の閉路(辺の重みの和が負になるような閉路)がない限り、負の辺があっても使える。 # 負の閉路を持つ場合は'NEGATIVE CYCLE'を、そうでない場合には(i,j)成分に # 頂点iから頂点jへの最短経路の距離を格納するdist_listをprintする関数 ...
s345414831
p03546
u252828980
1587239772
Python
PyPy3 (2.4.0)
py
Runtime Error
191
38640
653
import numpy as np from scipy.sparse.csgraph import floyd_warshall h,w = map(int,input().split()) d = np.zeros((10,10)) for i in range(10): a = list(map(int,input().split())) d[i] = a #print(d) def WF(b): for k in range(10): for i in range(10): for j in range(10): d[i][j...
s991869820
p03546
u252828980
1587239725
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38640
720
def main(): import numpy as np h,w = map(int,input().split()) d = np.zeros((10,10)) for i in range(10): a = list(map(int,input().split())) d[i] = a def WF(b): for k in range(10): for i in range(10): for j in range(10): d[i][j] ...
s957182162
p03546
u808593466
1586503368
Python
Python (3.4.3)
py
Runtime Error
17
2940
850
#include <bits/stdc++.h> typedef long long ll; #define MOD 1000000007 using namespace std; int main(){ int H,W; cin >> H >> W; int c[10][10]; int cnt[10] = {0}; int a; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { cin >> c[i][j]; } ...
s478664981
p03546
u738898077
1586496466
Python
Python (3.4.3)
py
Runtime Error
25
3444
455
h,w = map(int,input().split()) l = [list(map(int,input().split())) for i in range(10)] a = [list(map(int,input().split())) for i in range(h)] ans = 0 l = np.array(l) for rep in range(10): for i in range(10): for j in range(10): for k in range(10): if l[i][j] > l[i][k]+l[k][j]: ...
s731634130
p03546
u744920373
1586473941
Python
PyPy3 (2.4.0)
py
Runtime Error
205
41436
914
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return map(int, sys.stdin.readline().split()) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)] def dp2(ini, i, j): return [[ini]*i...
s101017083
p03546
u790710233
1586141260
Python
Python (3.4.3)
py
Runtime Error
273
17384
517
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import shortest_path from collections import defaultdict h, w = map(int, input().split()) table = [list(map(int, input().split())) for _ in range(10)] dd = defaultdict(int) for _ in range(h): for x in map(int, input().split()): if x == -1: ...
s855688896
p03546
u896741788
1586031573
Python
Python (3.4.3)
py
Runtime Error
17
3064
412
h,w=map(int,input().split()) ll=[list(map(int,input().split())) for i in range(10)] for i in range(10**3-1): for i in range(10): for j in range(10): if i!=j: ll[i][j]=min(ll[i][j],min(ll[i][o]+tra[o][j] for o in range(10) if o!=i and o!=j)) ans=0 for i in range(h): for j in ...
s453160787
p03546
u711238850
1585545206
Python
Python (3.4.3)
py
Runtime Error
31
3572
1585
import heapq import math class Graph: def __init__(self,v,w_e,w_v = None): super().__init__() self.v = v self.w_v = w_v self.w_e = [{} for _ in [0]*self.v] self.neighbor = [[] for _ in [0]*self.v] for a_i,b_i,w_i in w_e: self.w_e[a_i][b_i] = w_i#weight ...
s832115120
p03546
u103902792
1585433814
Python
Python (3.4.3)
py
Runtime Error
30
3064
377
h,w = map(int,input().split()) c = [[int(i) for i in input().split()] for _ in range(10)] A = {i:0 for i in range(10)} for _ in range(h): for i in input().split(): A[int(i)] += 1 for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][k] + c[k][j],c[i][j]) ans = 0 ...
s157207614
p03546
u145950990
1585362772
Python
PyPy3 (2.4.0)
py
Runtime Error
194
40172
303
h,w = map(int,input().split()) c = [list(map(int,input().split())) for _ in range(10)] a = [list(map(int,input().split())) for _ in range(h)] n = 10 from scipy.sparse.csgraph import floyd_warshall c = floyd_warshall(c) ans = 0 for i in a: for j in i: if j!=-1: ans += c[j][1] print(int(ans))
s429223896
p03546
u771365068
1582049977
Python
Python (3.4.3)
py
Runtime Error
17
3064
1342
def search(start: int, visited: list, power: list, min_power: int, min_powers: int) -> int: minimum = 10**4 if min_powers[start] != -1: return min_powers[start] + min_power if visited[1] == True: #print(f'{min_power=}') return min_power for i, v in enumerate(visited): if...
s877982163
p03546
u372144784
1581101949
Python
PyPy3 (2.4.0)
py
Runtime Error
170
39024
656
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines h,w = map(int,readline().split()) lst1 = [list(map(int,readline().split())) for i in range(10)] #まず、数字をiから1に変える時の最小コストを計算する。 from scipy.sparse.csgraph import shortest_path,floyd_warshall from scipy.spars...
s028477877
p03546
u134712256
1581032690
Python
Python (3.4.3)
py
Runtime Error
18
3064
499
aH,W = map(int,input().split()) c = [[-1 for i in range(10)]for j in range(10)] a = [[-1 for i in range(W)]for j in range(H)] for i in range(10): x = input().split() c[i] = [int(i) for i in x] for i in range(H): y = input().split() a[i] = [int(i) for i in y] for i in range(10): for j in range(10): for k...
s484073328
p03546
u667024514
1579000778
Python
Python (3.4.3)
py
Runtime Error
25
3444
430
h,w = map(int,input().split()) lis = [list(map(int,input().split())) for i in range(9)] li = [list(map(int,input().split())) for i in range(h)] for i in range(9): for j in range(9): for k in range(9): if lis[i][j] > lis[i][k] + lis[k][j]: lis[i][j] = lis[i][k] + lis[k][j] ans = ...
s438323968
p03546
u667024514
1579000741
Python
Python (3.4.3)
py
Runtime Error
17
3064
430
h,w = map(int,input().split()) lis = [list(map(int,input().split())) for i in ragne(9)] li = [list(map(int,input().split())) for i in range(h)] for i in range(9): for j in range(9): for k in range(9): if lis[i][j] > lis[i][k] + lis[k][j]: lis[i][j] = lis[i][k] + lis[k][j] ans = ...
s990121186
p03546
u768896740
1578272870
Python
Python (3.4.3)
py
Runtime Error
29
3700
1314
import math import itertools import collections h, w = map(int, input().split()) route_list = [] wall = [] count = 0 for _ in range(10): array = list(map(int, input().split())) route_list.append(array) for _ in range(h): array = list(map(int,input().split())) wall.append(array) node_num = len(rout...
s013277801
p03546
u078349616
1578247112
Python
Python (3.4.3)
py
Runtime Error
17
2940
387
# ABC79 D - Wall from scipy.sparse.csgraph import floyd_warshall from itertools import permutations H, W = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] C = floyd_warshall(C) cost = 0 for i in range(H): for a in A[i]: ...
s317060946
p03546
u994521204
1577716871
Python
Python (3.4.3)
py
Runtime Error
17
3060
515
h, w = map(int, input().split()) C = [list(map(int, input().split())) for i in range(10)] A = [list(map(int, input().split())) for i in range(h)] # C[i][j]はiをjにするのに必要なコスト # warshal-floyd for k in range(10): for i in range(10): for j in range(10): C[i][j] = min(C[i][j], C[i][k] + C[k][j]) for i ...
s461954136
p03546
u934868410
1577058601
Python
Python (3.4.3)
py
Runtime Error
17
3064
393
h,w = map(int, input().split()) c = [] a = [] for i in range(10): c.append(list(map(int, input().split()))) for i in range(h): a.append(list(map(int, input().split()))) for k in range(10): for i in range(10): for j in range(10): c[i][j] = min(c[i][j]), c[i][k] + c[k][j]) ans = 0 for i in range(h...
s054436287
p03546
u989345508
1575905929
Python
Python (3.4.3)
py
Runtime Error
25
3064
492
dp=[[0 for j in range(10)] for i in range(10)] h,w=map(int,input().split()) for i in range(10): s=list(map(int,input().split())) for j in range(10): dp[i][j]=s[j] for k in range(10): for i in range(10): for j in range(10): dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]) c=0 for i in r...
s584586989
p03546
u989345508
1575905261
Python
Python (3.4.3)
py
Runtime Error
27
3064
584
dp=[[0 for j in range(10)] for i in range(10)] #print(dp) h,w=map(int,input().split()) for i in range(10): s=list(map(int,input().split())) for j in range(10): dp[i][j]=s[j] #print(dp) for k in range(10): for i in range(10): for j in range(10): dp[i][j]=min(dp[i][j],dp[i][k]+dp...
s742776897
p03546
u989345508
1575905110
Python
Python (3.4.3)
py
Runtime Error
25
3064
584
dp=[[0 for j in range(10)] for i in range(10)] #print(dp) h,w=map(int,input().split()) for i in range(10): s=list(map(int,input().split())) for j in range(10): dp[i][j]=s[j] #print(dp) for k in range(10): for i in range(10): for j in range(10): dp[i][j]=min(dp[i][j],dp[i][k]+dp...
s793079970
p03546
u642120132
1572716886
Python
Python (3.4.3)
py
Runtime Error
17
2940
735
#include <bits/stdc++.h> using namespace std; int main() { int H, W; cin >> H >> W; vector<vector<int>> G(10, vector<int>(10)); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) cin >> G.at(i).at(j); } vector<vector<int>> A(H, vector<int>(W)); for (int i = 0; i < H; i++) { for (int j = 0;...
s950417968
p03546
u691896522
1571859026
Python
Python (3.4.3)
py
Runtime Error
34
3444
773
#input h, w = list(map(int, input().split())) c = [0 for i in range(10)] for i in range(10): c[i] = list(map(int, input().split())) wall = [0 for i in range(w)] for i in range(h): wall[i] = list(map(int, input().split())) #solve #1へのコスト costone = [(10**3) + 1 for i in range(11)] #-1, 1はコストがかからないため0で初期化 cost...
s107983228
p03546
u691896522
1571687471
Python
Python (3.4.3)
py
Runtime Error
34
3444
762
#input h, w = list(map(int, input().split())) c = [0 for i in range(10)] for i in range(10): c[i] = list(map(int, input().split())) wall = [0 for i in range(w)] for i in range(h): wall[i] = list(map(int, input().split())) #solve #0へのコスト costone = [((10**4) + 1) for i in range(11)] #-1, 1はコストがかからないため0で初期化 co...
s035461424
p03546
u691896522
1571687083
Python
Python (3.4.3)
py
Runtime Error
34
3444
762
#input h, w = list(map(int, input().split())) c = [0 for i in range(10)] for i in range(10): c[i] = list(map(int, input().split())) wall = [0 for i in range(w)] for i in range(h): wall[i] = list(map(int, input().split())) #solve #0へのコスト costone = [((10**3) + 1) for i in range(11)] #-1, 1はコストがかからないため0で初期化 co...
s352363505
p03546
u644907318
1570825357
Python
Python (3.4.3)
py
Runtime Error
34
3444
428
H,W = map(int,input().split()) B = [list(map(int,input().split())) for _ in range(10)] A = [list(map(int,input().split())) for _ in range(H)] for i in range(10): for j in range(10): for k in range(10): B[i][j] = min(B[i][j],B[i][k]+B[k][j]) G = {i:0 for i in range(-1,10)} for i in range(H): ...
s497771983
p03546
u466331465
1570125481
Python
Python (3.4.3)
py
Runtime Error
620
50292
581
import itertools import sys input = sys.stdin.readline def inputs(): return [int(x) for x in input().split()] H,W = inputs() c = [inputs() for _ in range(10)] HW = [inputs() for _ in range(H)] A = (0,9,8,7,6,5,4,3,2) B = list(itertools.permutations(A)) N = [c[i][1] for i in range(10)] for i in B: a = i[0] a...
s400858424
p03546
u943624079
1570124372
Python
Python (3.4.3)
py
Runtime Error
711
50292
467
import itertools import sys input = sys.stdin.readline def inputs(): return [int(x) for x in input().split()] H,W = inputs() c = [inputs() for _ in range(10)] HW = [inputs() for _ in range(H)] A = (0,9,8,7,6,5,4,3,2) B = list(itertools.permutations(A)) N = [c[i][1] for i in range(10)] ans = 0 for i in B: a = i[...
s625049436
p03546
u466331465
1570120808
Python
Python (3.4.3)
py
Runtime Error
682
50292
593
import itertools import sys input = sys.stdin.readline def inputs(): return [int(x) for x in input().split()] H,W = inputs() c = [inputs() for _ in range(10)] HW = [inputs() for _ in range(H)] A = (0,9,8,7,6,5,4,3,2) B = list(itertools.permutations(A)) N = [c[i][1] for i in range(10)] ans = 0 for i in B: a = i[...
s075763893
p03546
u466331465
1570120662
Python
PyPy3 (2.4.0)
py
Runtime Error
333
90796
593
import itertools import sys input = sys.stdin.readline def inputs(): return [int(x) for x in input().split()] H,W = inputs() c = [inputs() for _ in range(10)] HW = [inputs() for _ in range(H)] A = (0,9,8,7,6,5,4,3,2) B = list(itertools.permutations(A)) N = [c[i][1] for i in range(10)] ans = 0 for i in B: a = i[...
s670897369
p03546
u780962115
1569809887
Python
Python (3.4.3)
py
Runtime Error
102
3572
1120
magialist=[] datalist=[] h,w=map(int,input().split()) #for i in range(10): #add=list(map(int,input().split())) #magialist.append(add) add=list(map(int,input().split())) for i in range(10): magialist.append(add) for j in range(h): add1=list(map(int,input().split())) datalist.extend(add1) storeli...
s921768714
p03546
u780962115
1569807318
Python
Python (3.4.3)
py
Runtime Error
26
3512
951
magialist=[] datalist=[] h,w=map(int,input().split()) for i in range(10): add=list(map(int,input().split())) magialist.append(add) for j in range(h): add1=list(map(int,input().split())) datalist.extend(add1) storelist=[[[]*10]*10]*10 #わーシャルフロイド法 def warsyaru(i,j,k): if k==0: return m...
s931718980
p03546
u780962115
1569807150
Python
Python (3.4.3)
py
Runtime Error
18
3064
867
magialist=[] datalist=[] h,w=map(int,input().split()) for i in range(10): add=list(map(int,input().split())) magialist.append(add) for j in range(h): add1=list(map(int,input().split())) datalist.extend(add1) storelist=[[[]*10]*10]*10 #わーシャルフロイド法 def warsyaru(i,j,k): if k==0: return m...
s948393737
p03546
u921773161
1569524275
Python
Python (3.4.3)
py
Runtime Error
34
3828
541
#%% import copy H, W = map(int, input().split()) c = [[int(_) for _ in input().split()] for _ in range(10)] A = [[int(_) for _ in input().split()] for _ in range(H)] d = copy.deepcopy(c) for i in range(10): for j in range(10): for k in range(10): d[i][j] = min(d[i][j], d[i][k]+d[k][j]) ans...
s981017469
p03546
u118642796
1568919854
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38480
641
import heapq H,W = map(int,input().split()) C = [[int(x) for x in input().split()] for _ in range(10)] num = [0] * 10 for _ in range(H): for x in input().split(): if int(x) != -1 num[int(x)] += 1 que = [] flag = [True]*10 flag[1] = False cost = [10**10]*10 cost[1] = 0 for i in range(10): ...
s626304834
p03546
u118642796
1568919214
Python
PyPy3 (2.4.0)
py
Runtime Error
170
38640
612
import heqpq H,W = map(int,input().split()) C = [[int(x) for x in input().split()] for _ in range(10)] num = [0] * 10 for _ in range(H): for x in input().split(): num[int(x)] += 1 que = [] flag = [True]*10 flag[1] = False cost = [10**10]*10 cost[1] = 0 for i in range(10): if flag[i]: heqpq.he...
s604109126
p03546
u296518383
1568594690
Python
Python (3.4.3)
py
Runtime Error
18
3064
339
H,W=map(int,input().split()) c=[] for i in range(10): c.append(list(map(int,input().split()))) for i in range(10): for j in range(10): for k in range(10): c[i][j]=min(c[i][j],c[i][k]+c[k][j]) #print(c) ans=0 for i in range(H): A=list(map(int,input())) for j in A: if A[i][j]!=-1: ans+=c[A[i...
s840309705
p03546
u698176039
1567613610
Python
Python (3.4.3)
py
Runtime Error
26
3444
447
H,W = map(int,input().split()) C = [list(map(int,input().split())) for _ in range(10)] A = [list(map(int,input().split())) for _ in range(H)] inf = 10**9+7 point = [inf] * 10 for i in range(10): tmp = 0 for j in range(10): tmp += C[i][j] point[i] = min(point[i],tmp+C[j][1]) ans = ...
s478633399
p03546
u820047642
1567428439
Python
Python (3.4.3)
py
Runtime Error
20
3188
431
import sys input=sys.stdin.readline h,w=map(int,input().split()) distance=[] for _ in range(10): distance.append(list(map(int,input().split()))) for k in range(10): for j in range(10): for i in range(10): distance[i][j]=min(distance[i][j],distance[i][k]+distance[k][j]) ans=0 for _ in range(h): ...
s019812422
p03546
u423585790
1567014044
Python
PyPy3 (2.4.0)
py
Runtime Error
227
42988
2147
#!/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 bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right def LI(): re...
s005464684
p03546
u423585790
1567013998
Python
PyPy3 (2.4.0)
py
Runtime Error
209
39792
2147
#!/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 bisect_left = bisect.bisect_left bisect_right = bisect.bisect_right def LI(): re...
s774628712
p03546
u499381410
1566340269
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
1184
from heapq import heappop, heappush import numpy as np def dijkstra(graph, n, vst=0): distance = [float('inf')] * n distance[vst] = 0 checked_v = [0] * n route = [''] * 10 route[vst] = str(vst) dist = [float('inf')] * n dist[vst] = 0 q = [] heappush(q, (0, vst)) for _ in range...
s142521922
p03546
u558242240
1566155076
Python
Python (3.4.3)
py
Runtime Error
22
5620
562
h, w = map(int, input().split()) d = [] for i in range(10): d.append(map(int, input().split())) a = [] for i in range(h): a.append(map(int, input().split())) for k in range(10): for i in range(10): for j in range(10): if d[i][j] > d[i][k] + d[k][j]: d[i][j] = d[i][k] + d[...
s928728380
p03546
u558242240
1566154946
Python
Python (3.4.3)
py
Runtime Error
17
3064
552
h, w = input().split() d = [] for i in range(10): d.append(map(int, input().split())) a = [] for i in range(h): a.append(map(int, input().split())) for k in range(10): for i in range(10): for j in range(10): if d[i][j] > d[i][k] + d[k][j]: d[i][j] = d[i][k] + d[k][j] #fo...
s435957418
p03546
u558242240
1566154574
Python
Python (3.4.3)
py
Runtime Error
18
3064
1158
x = input().split() #x = "3 5 0 4 3 6 2 7 2 5 3 3 4 0 5 3 7 5 3 7 2 7 5 7 0 7 2 9 3 2 9 1 3 6 2 0 2 4 6 4 2 3 3 5 7 4 0 6 9 7 6 7 9 8 5 2 2 0 4 7 6 5 5 4 6 3 2 3 0 5 4 3 3 6 2 3 4 2 4 0 8 9 4 6 5 4 3 5 3 2 0 8 2 1 3 4 5 7 8 6 4 0 3 5 2 6 1 2 5 3 2 1 6 9 2 5 6".split() #x = "2 4 0 9 9 9 9 9 9 9 9 9 9 0 9 9 9 9 9 9 9 9 9...
s432196203
p03546
u623819879
1561595203
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38384
455
from scipy.sparse import csr_matrix from scipy.sparse.csgraph import floyd_warshall graph=[] h,w=map(int,input().split()) for i in range(10): graph.append(list(map(int,input().split()))) graph = csr_matrix(graph) d, p = floyd_warshall(csgraph=graph, directed=True, return_predecessors=True) #print(d) dic={-1:0} for...
s149210016
p03546
u065446124
1559871173
Python
Python (3.4.3)
py
Runtime Error
18
3064
424
import networkx as nx G=nx.DiGraph() G.add_nodes_from([i for i in range(0,10)]) h,w=map(int,input().split()) for i in range(10): l=list(map(int,input().split())) for j in range(10): G.add_edge(i,j,weight=l[j]) d={} for i in range(10): l,p=nx.multi_source_dijkstra(G,[i],target=1) d[i]=l ans=0 fo...
s519458134
p03546
u380772254
1559414974
Python
Python (3.4.3)
py
Runtime Error
26
3444
1298
# ABC 079 D class WarshallFloyd: def __init__(self, adj): """ ワーシャル・フロイド法によって全頂点間の最短距離を O(|V|^3) で計算する。 :param adj: 隣接行列 adj[i][j] でi番目の頂点からj番目の頂点へのコストを示す パスがなければINF """ self._dist = adj # 各頂点間の最短距離 初期値として隣接行列をそのまま用い、[i, i]要素を0に初期化する for i in range(len(adj)): ...
s998704669
p03546
u380772254
1559414831
Python
Python (3.4.3)
py
Runtime Error
26
3444
1305
# ABC 079 D class WarshallFloyd(object): def __init__(self, adj): """ ワーシャル・フロイド法によって全頂点間の最短距離を O(|V|^3) で計算する。 :param adj: 隣接行列 adj[i][j] でi番目の頂点からj番目の頂点へのコストを示す パスがなければINF """ self._dist = adj # 各頂点間の最短距離 初期値として隣接行列をそのまま用い、[i, i]要素を0に初期化する for i in range(len(ad...
s470962480
p03546
u123756661
1558758812
Python
Python (3.4.3)
py
Runtime Error
17
2940
575
def sol(): h,w=map(int,input().split()) c=[list(map(int,input().split())) for i in range(10)] a=[list(map(int,input().split())) for i in range(h)] for k in range(10): for i in range(10): for j in range(10): #if (c[i][k]!=0 and c[k][j]!=0): c[i][j]=min(c[i][j],c[i][k]+...
s198759511
p03546
u123756661
1558755372
Python
Python (3.4.3)
py
Runtime Error
19
3064
794
def son(): h,w=map(int,input().split()) c=[] for i in range(10): l=[int(i) for i in input().split()] c.append(l) a=[] for i in range(h): l=[int(i) for i in input().split()] a.append(l) p=[0]*10 for i in range(10): if i==1: continue d=[1003]*10 ...
s702192617
p03546
u389910364
1558222044
Python
Python (3.4.3)
py
Runtime Error
182
14368
457
import sys import numpy as np from scipy.sparse.csgraph import dijkstra sys.setrecursionlimit(10000) INF = float('inf') H, W = list(map(int, input().split())) C = np.array([list(map(int, input().split())) for _ in range(10)], dtype=int) A = np.array([list(map(int, input().split())) for _ in range(H)], dtype=int) A[A...
s223417526
p03546
u187205913
1557693103
Python
PyPy3 (2.4.0)
py
Runtime Error
189
40300
544
h,w = map(int,input().split()) c = [list(map(int,input().split())) for _ in range(10)] a = [list(map(int,input().split())) for _ in range(h)] def dfs(nv,vl,cost): if nv==1: return cost vl_ = vl.copy() vl_.append(nv) ret = [] for i in range(10): if not i in vl_: ret.appen...
s429104147
p03546
u187205913
1557692926
Python
PyPy3 (2.4.0)
py
Runtime Error
187
40044
544
h,w = map(int,input().split()) c = [list(map(int,input().split())) for _ in range(10)] a = [list(map(int,input().split())) for _ in range(h)] def dfs(nv,vl,cost): if nv==1: return cost vl_ = vl.copy() vl_.append(nv) ret = [] for i in range(10): if not i in vl_: ret.appen...
s550926337
p03546
u631277801
1555416161
Python
Python (3.4.3)
py
Runtime Error
25
3316
418
h,w = map(int, input().split()) cost = [list(map(int, input().split())) for _ in range(10)] wall = [list(map(int, input().split())) for _ in range(h)] nuns = 10 for k in range(nums): for i in range(nums): for j in range(nums): cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]) a...
s500103879
p03546
u631277801
1555416077
Python
Python (3.4.3)
py
Runtime Error
17
2940
873
h,w = map(int, input().split()) cost = [lh,w = map(int, input().split()) cost = [list(map(int, input().split())) for _ in range(10)] wall = [list(map(int, input().split())) for _ in range(h)] nuns = 10 for k in range(nums): for i in range(nums): for j in range(nums): cost[i][j] = min(cost[i][j], ...
s394615432
p03546
u785578220
1550137445
Python
Python (3.4.3)
py
Runtime Error
18
3188
451
N, M = map(int, input().split()) inf = float("inf") dp = [[inf]*100 for _ in [0]*100] for i in range(N):dp[i][i] = 0 d = [list(map(int, input().split())) for i in range(10)] m = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(10): for j in range(10): dp[i][j] = d[i][j] for k in ...
s462233708
p03546
u785578220
1550137333
Python
Python (3.4.3)
py
Runtime Error
22
3188
583
N, M = map(int, input().split()) inf = float("inf") dp = [[inf]*100 for _ in [0]*100] for i in range(N):dp[i][i] = 0 d = [list(map(int, input().split())) for i in range(10)] m = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(10): for j in range(10): dp[i][j] = d[i][j] for k in ...
s138886551
p03546
u785578220
1550137270
Python
Python (3.4.3)
py
Runtime Error
19
3064
581
N, M = map(int, input().split()) inf = float("inf") dp = [[inf]*10 for _ in [0]*10] for i in range(N):dp[i][i] = 0 d = [list(map(int, input().split())) for i in range(10)] m = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(10): for j in range(10): dp[i][j] = d[i][j] for k in ra...
s878345804
p03546
u785578220
1550136780
Python
Python (3.4.3)
py
Runtime Error
18
3064
564
N, M = map(int, input().split()) inf = float("inf") dp = [[inf]*10 for _ in [0]*10] for i in range(N):dp[i][i] = 0 d = [list(map(int, input().split())) for i in range(10)] m = [list(map(int, input().split())) for i in range(N)] ans = 0 for i in range(10): for j in range(10): dp[i][j] = d[i][j] for k in ra...
s498597221
p03546
u200030766
1542694176
Python
Python (3.4.3)
py
Runtime Error
17
2940
478
H, W=map(int,input().strip().split(' ')) def w_f(): cost=[] for i in range(10): cost.append(list(map(int,input().strip().split(' ')))) for k in range(10): for i in range(10): for j in range(10): cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]) rerurn cost ...
s784909169
p03546
u200030766
1542693858
Python
Python (3.4.3)
py
Runtime Error
17
3064
493
H, W=map(int,input().strip().split(' ')) V=10 E=45 inf=10**9 def w_f(): cost=[] for i in range(10): cost.append(list(map(int,input().strip().split(' ')))) for i in range(V): for j in range(V): for k in range(V): cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]) ...
s729186481
p03546
u200030766
1542693139
Python
Python (3.4.3)
py
Runtime Error
17
3064
536
H, W=map(int,input().strip().split(' ')) V=10 E=45 inf=10**9 def w_f(): for i in range(10): c=list(map(int,input().strip().split(' '))) for j in range(10): cost[i][j]=c[j] for i in range(V): for j in range(V): for k in range(V): cost[i][j]=min(c...
s585086837
p03546
u879870653
1539344618
Python
Python (3.4.3)
py
Runtime Error
17
3064
451
H,W = map(int,input().split()) C = [] A = [] for i in range(10) : C.append(list(map(int,inpput().split()))) for i in range(H) : A.append(list(map(int,input().split()))) for i in range(10) : for j in range(10) : for k in range(10) : C[j][k] = min(C[j][k], C[j][i]+C[i][k]) ans = 0 for row ...
s950462418
p03546
u138486156
1535226446
Python
Python (3.4.3)
py
Runtime Error
17
2940
446
h,w = map(int, input().split()) power = [list(map(int,input().split())) for i in range(10)] #ワーシャルフロイド法 for i in range(10): for j in range(10): for k in range(10): power[j][k] = min([power[j][k], power[j][i] + power[i][k]) ans = 0 for i in range(h): wall = list(map(int, input().split())) ...
s627128979
p03546
u828847847
1534496617
Python
Python (2.7.6)
py
Runtime Error
10
2568
322
h,w = map(int,raw_input().split()) d = [map(int,raw_input().split()) for i in range(10)] for k in range(10): for i in range(10): for j in range(10): d[i][j] = min(d[i][j], d[i][k] + d[k][j]) arr = [map(int,raw_input().split()) for i in range(h)] print sum(sum(d[a][1] if a>=0 else 0 for a in aa) for aa in ar...
s850957183
p03546
u910341281
1529857421
Python
Python (3.4.3)
py
Runtime Error
45
4272
1844
import math #グラフの作成 def make_list(V,E): edges = [] path=[[0]*E for i in range(V) ] #ルート作成に必要になる for i in range(V): a=[int(x) for x in str(input()).split()] for j in range(len(a)): #print("j",j) path[i][j]=i if j!= i and a[j]==0: ...
s257502261
p03546
u910341281
1529857270
Python
Python (3.4.3)
py
Runtime Error
46
4272
1913
import math #グラフの作成 def make_list(V,E): edges = [] path=[[0]*E for i in range(V) ] #ルート作成に必要になる for i in range(V): a=[int(x) for x in str(input()).split()] for j in range(len(a)): #print("j",j) path[i][j]=i if j!= i and a[j]==0: ...
s241966767
p03546
u910341281
1529856630
Python
Python (3.4.3)
py
Runtime Error
44
4296
1876
import math #グラフの作成 def make_list(V,E): edges = [] path=[[0]*E for i in range(V) ] #ルート作成に必要になる for i in range(V): a = list(map(int, input().split())) for j in range(len(a)): #print("j",j) path[i][j]=i if j!= i and a[j]==0: a[j...
s873453846
p03546
u162660367
1529332120
Python
Python (3.4.3)
py
Runtime Error
26
3444
399
H,W=map(int,input().split()) C=[] A=[] for i in range(10): C.append(list(map(int,input().split()))) for i in range(H): A.append(list(map(int,input().split()))) # WF for i in range(10): for j in range(10): for k in range(10): C[i][j]=min(C[i][j], C[i][k]+C[k][j]) for i in range(10): c...
s177201015
p03546
u339025042
1528299484
Python
Python (3.4.3)
py
Runtime Error
18
3064
750
import networkx as nx H, W = map(int, input().split()) clist = [] for i in range(10): clist.append(list(map(int,input().split()))) Alist = [] for h in range(H): Alist.append(list(map(int,input().split()))) graph = nx.DiGraph() # ノードを追加する for i in range(10): graph.add_node(i) # ノード間をエッジでつなぐ for i in rang...
s407998593
p03546
u339025042
1528299242
Python
Python (3.4.3)
py
Runtime Error
18
3064
750
import networkx as nx H, W = map(int, input().split()) clist = [] for i in range(10): clist.append(list(map(int,input().split()))) Alist = [] for h in range(H): Alist.append(list(map(int,input().split()))) graph = nx.DiGraph() # ノードを追加する for i in range(10): graph.add_node(i) # ノード間をエッジでつなぐ for i in rang...
s065351973
p03546
u562016607
1528223532
Python
Python (3.4.3)
py
Runtime Error
21
5620
358
H,W=map(int,input().split()) c=[map(int,input().split()) for i in range(10)] A=[map(int,input().split()) for i in range(H)] for k in range(10): for i in range(10): for j in range(10): if c[i][j]<c[i][k]+c[k][j]: c[i][j]=c[i][k]+c[k][j] ans=0 for i in range(H): for j in range(W): if A[i][j]!=-1...
s438388927
p03546
u884982181
1526759937
Python
Python (3.4.3)
py
Runtime Error
160
14812
1080
import numpy as np H,W = map(int,input().split()) H += -1 W += -1 import sys ma = [[c for c in l.strip()] for l in sys.stdin] ya = [] for s in ma: ya.extend(s) count = ya.count(".") ma = np.array(ma,"U10") ma[0][0] = 1 que = [] que.append([0,0]) while len(que) > 0: y,x = que.pop(0) if y == H and x == W: break...
s980272652
p03546
u327248573
1526081764
Python
Python (3.4.3)
py
Runtime Error
152
12484
1028
import numpy as np import itertools _input = input #''' allinputs = iter(input().splitlines()) input = lambda : next(allinputs) #''' H, W = map(int, input().split(' ')) MPTable = np.array([list(map(int, input().split(' '))) for _ in range(10)]) NumTable = np.array([list(map(int, input().split(' '))) for _ in range(H)]...
s115086288
p03546
u281303342
1525222560
Python
Python (3.4.3)
py
Runtime Error
18
3064
410
H,W = map(int,input().split()) C = [0]*10 for i in range(10): C[i] = list(map(int,input().split())) A = [0]*10 for i in range(H): A[i] = list(map(int,input().split())) for k in range(10): for i in range(10): for j in range(10): C[i][j] = min(C[i][j],C[i][k]+C[k][j]) Ans = 0 for i in rang...
s579953414
p03546
u000349418
1516688304
Python
Python (3.4.3)
py
Runtime Error
17
2940
233
3 5 0 4 3 6 2 7 2 5 3 3 4 0 5 3 7 5 3 7 2 7 5 7 0 7 2 9 3 2 9 1 3 6 2 0 2 4 6 4 2 3 3 5 7 4 0 6 9 7 6 7 9 8 5 2 2 0 4 7 6 5 5 4 6 3 2 3 0 5 4 3 3 6 2 3 4 2 4 0 8 9 4 6 5 4 3 5 3 2 0 8 2 1 3 4 5 7 8 6 4 0 3 5 2 6 1 2 5 3 2 1 6 9 2 5 6
s738488743
p03546
u562016607
1512772606
Python
Python (3.4.3)
py
Runtime Error
17
2940
1035
st=input().split() H=int(st[0]);W=int(st[1]) c=[[0 for i in range(10)] for i in range(10)] A=[[0 for i in range(W)]for i in range(H)] for i in range(10): st=input().split() for j in range(10): c[i][j]=int(st[j]) for i in range(H): st=input().split() fo...
s706191169
p03546
u562016607
1512772508
Python
Python (3.4.3)
py
Runtime Error
36
3444
828
st=input().split() H=int(st[0]);W=int(st[1]) c=[[0 for i in range(10)] for i in range(10)] A=[[0 for i in range(W)]for i in range(H)] for i in range(10): st=input().split() for j in range(10): c[i][j]=int(st[j]) for i in range(H): st=input().split() for j in range(W): A[i][j]=int(st[j]) ...
s358181202
p03546
u562016607
1512771856
Python
Python (3.4.3)
py
Runtime Error
36
3444
860
st=input().split() H=int(st[0]);W=int(st[1]) c=[[0 for i in range(10)] for i in range(10)] A=[[0 for i in range(W)]for i in range(H)] for i in range(10): st=input().split() for j in range(10): c[i][j]=int(st[j]) for i in range(H): st=input().split() for j in range(W): A[i][j]=int(st[j]) ...
s598352014
p03546
u787988531
1512771677
Python
Python (2.7.6)
py
Runtime Error
39
2948
1445
inp = [] inp.append(raw_input()) for i in xrange(int(inp[0].split(" ")[0])): inp.append(raw_input()) Size = inp[0] Mml = [None, 0] + [None] * 8 Cij = [[0] * 10 for i in range(10)] for i in xrange(10): for j, a in enumerate(map(int,inp[i + 1].split(" "))): Cij[i][j] = a #print a, #print de...
s627303627
p03546
u787988531
1512771264
Python
Python (2.7.6)
py
Runtime Error
11
2696
1372
inp = raw_input().split("\r\n") Size = inp[0] Mml = [None, 0] + [None] * 8 Cij = [[0] * 10 for i in range(10)] for i in xrange(10): for j, a in enumerate(map(int,inp[i + 1].split(" "))): Cij[i][j] = a #print a, #print def sloveMm(n): global Mml if(Mml[n] != None): return Mml[n...
s294364004
p03546
u787988531
1512771141
Python
Python (2.7.6)
py
Runtime Error
11
2696
1370
inp = raw_input().split("\n") Size = inp[0] Mml = [None, 0] + [None] * 8 Cij = [[0] * 10 for i in range(10)] for i in xrange(10): for j, a in enumerate(map(int,inp[i + 1].split(" "))): Cij[i][j] = a #print a, #print def sloveMm(n): global Mml if(Mml[n] != None): return Mml[n] ...
s159154637
p03546
u787988531
1512758728
Python
Python (2.7.6)
py
Runtime Error
11
2696
951
inp = raw_input().split("\n") Size = inp[0] Mml = [None, 0] + [None] * 8 Cij = [] for i in xrange(10): Cij.append(inp[i + 1].split(" ")) def sloveMm(n): global Mml if(Mml[n] != None): return Mml[n] Nmm = Cij[n][1] rourt = [(n, 0, Nmm)] while len(rourt) > 0: rl = len(rourt) ...
s136042973
p03546
u563710899
1512137781
Python
Python (3.4.3)
py
Runtime Error
22
5620
675
H,W=map(int,input().split()) C=[0 for i in range(9)] for i in range(9): C[i]=map(int,input().split()) A=[0 for i in range(H)] for i in range(H): A[i]=map(int,input().split()) def mini(S,dic,ans): if(S=={0,1,2,3,4,5,6,7,8}): return ans min_val=min(dic.items()) for i in dic.keys(): ...
s259430265
p03546
u579152247
1511376101
Python
Python (2.7.6)
py
Runtime Error
12
2816
3151
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.8 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (2, 6, 0): def swig_import_helper(): from os.path imp...
s025112230
p03546
u880646180
1511154627
Python
Python (3.4.3)
py
Runtime Error
39
3316
552
h, w = [int(i) for i in input().split()] k = [] wl = [] for i in range(0, 10): k.append([int(i) for i in input().split()]) for i in range(0, h): wl.append([int(i) for i in input().split()]) n = {1:0} while len(n) < 10: c = 1000 mn = 10 for a in n.keys(): a2 = int(a) for b in range(0, 10): ...
s665760350
p03546
u880646180
1511154448
Python
Python (3.4.3)
py
Runtime Error
33
3316
522
h, w = [int(i) for i in input().split()] k = [] wl = [] for i in range(0, 10): k.append([int(i) for i in input().split()]) for i in range(0, h): wl.append([int(i) for i in input().split()]) n = {1:0} while len(n) < 10: c = 1000 mn = 10 for a in n.keys(): a2 = int(a) for b in range(0, 10): ...
s243869682
p03546
u882200107
1511066909
Python
Python (3.4.3)
py
Runtime Error
27
3444
1058
# coding: utf-8 import math H, W = (int(x) for x in input().split()) convert = [[int(x) for x in input().split()] for _ in range(10)] table = [[int(x) for x in input().split()] for _ in range(H)] conv_to_one = [0] * 10 for i in [x for x in range(10) if (x != 1)]: distance = [math.inf for _ in range(10)] dista...
s548651011
p03546
u225528554
1511066521
Python
Python (3.4.3)
py
Runtime Error
19
3064
472
if __name__=="__main__": sum = 0 x,y = map(int,input().split()) c = [list(map(int,input().split())) for n in range(10)] for k in range(10): for i in range(10): for j in range(10): if c[i][j]>c[i][k]+c[k][j]: c[i][j] = c[i][k]+c[k][j] for i in ...
s718344452
p03546
u225528554
1511066444
Python
Python (3.4.3)
py
Runtime Error
18
3064
472
if __name__=="__main__": sum = 0 x,y = map(int,input().split()) c = [list(map(int,input().split())) for n in range(10)] for k in range(10): for i in range(10): for j in range(10): if c[i][j]>c[i][k]+c[k][j]: c[i][j] = c[i][k]+c[k][j] for i in ...
s951475057
p03546
u263612046
1511065433
Python
Python (3.4.3)
py
Runtime Error
17
2940
655
def main(): H,W = map(int,input().split()) C = 10 c = [] for i in range(C): c.append(list(map(int,input().split()))) a = [] for i in range(H): a.append(list(map(int,input().split()))) for k in range(C): for...