結果

問題 No.1344 Typical Shortest Path Sum
ユーザー AEnAEn
提出日時 2022-11-21 00:06:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 81,812 KB
実行使用メモリ 76,212 KB
最終ジャッジ日時 2023-10-21 19:05:09
合計ジャッジ時間 8,510 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,520 KB
testcase_01 AC 38 ms
53,520 KB
testcase_02 AC 38 ms
53,520 KB
testcase_03 AC 64 ms
68,548 KB
testcase_04 AC 51 ms
64,300 KB
testcase_05 AC 37 ms
53,520 KB
testcase_06 AC 38 ms
53,520 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 39 ms
53,520 KB
testcase_10 AC 38 ms
53,520 KB
testcase_11 AC 38 ms
53,520 KB
testcase_12 WA -
testcase_13 AC 38 ms
53,520 KB
testcase_14 AC 39 ms
53,520 KB
testcase_15 AC 38 ms
53,520 KB
testcase_16 AC 88 ms
75,948 KB
testcase_17 AC 38 ms
53,520 KB
testcase_18 AC 38 ms
53,520 KB
testcase_19 AC 38 ms
53,520 KB
testcase_20 AC 38 ms
53,520 KB
testcase_21 AC 38 ms
53,520 KB
testcase_22 AC 37 ms
53,520 KB
testcase_23 AC 39 ms
53,520 KB
testcase_24 AC 38 ms
53,520 KB
testcase_25 AC 38 ms
53,520 KB
testcase_26 AC 38 ms
53,520 KB
testcase_27 AC 38 ms
53,520 KB
testcase_28 AC 38 ms
53,520 KB
testcase_29 AC 38 ms
53,520 KB
testcase_30 AC 38 ms
53,520 KB
testcase_31 AC 38 ms
53,520 KB
testcase_32 AC 38 ms
53,520 KB
testcase_33 AC 38 ms
53,520 KB
testcase_34 AC 38 ms
53,520 KB
testcase_35 AC 38 ms
53,520 KB
testcase_36 AC 39 ms
53,520 KB
testcase_37 AC 39 ms
53,520 KB
testcase_38 AC 39 ms
53,520 KB
testcase_39 AC 38 ms
53,520 KB
testcase_40 AC 112 ms
76,132 KB
testcase_41 AC 119 ms
76,124 KB
testcase_42 AC 116 ms
76,060 KB
testcase_43 AC 109 ms
76,040 KB
testcase_44 AC 114 ms
76,044 KB
testcase_45 AC 116 ms
76,104 KB
testcase_46 AC 113 ms
76,212 KB
testcase_47 AC 111 ms
76,056 KB
testcase_48 AC 120 ms
76,172 KB
testcase_49 AC 107 ms
76,024 KB
testcase_50 AC 112 ms
76,040 KB
testcase_51 AC 117 ms
76,088 KB
testcase_52 AC 111 ms
75,948 KB
testcase_53 AC 123 ms
76,096 KB
testcase_54 AC 109 ms
76,212 KB
testcase_55 AC 115 ms
76,212 KB
testcase_56 AC 116 ms
76,084 KB
testcase_57 AC 110 ms
76,024 KB
testcase_58 AC 117 ms
76,212 KB
testcase_59 AC 114 ms
76,056 KB
testcase_60 AC 48 ms
62,004 KB
testcase_61 AC 38 ms
53,520 KB
testcase_62 AC 79 ms
73,864 KB
testcase_63 AC 54 ms
64,344 KB
testcase_64 AC 54 ms
64,344 KB
testcase_65 AC 80 ms
74,428 KB
testcase_66 AC 78 ms
73,872 KB
testcase_67 AC 78 ms
73,872 KB
testcase_68 AC 51 ms
62,296 KB
testcase_69 AC 51 ms
62,092 KB
testcase_70 AC 53 ms
64,128 KB
testcase_71 AC 39 ms
53,532 KB
testcase_72 AC 38 ms
53,532 KB
testcase_73 AC 38 ms
53,532 KB
testcase_74 AC 38 ms
53,532 KB
testcase_75 AC 38 ms
53,532 KB
testcase_76 AC 37 ms
53,532 KB
testcase_77 AC 38 ms
53,532 KB
testcase_78 AC 38 ms
53,532 KB
testcase_79 AC 59 ms
66,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

dis = [[float('inf')]*N for _ in range(N)]
for i in range(N):
    dis[i][i]=0
for i in range(M):
    s,t,d = map(int, input().split())
    s-=1;t-=1
    dis[s][t] = d

for k in range(N):
    for i in range(N):
        for j in range(N):
            dis[i][j] = min(dis[i][j],dis[i][k]+dis[k][j])

for i in range(N):
    res = 0
    for j in range(N):
        if dis[i][j]==float('inf'):
            continue
        res += dis[i][j]
    print(res)
0