結果

問題 No.1344 Typical Shortest Path Sum
ユーザー 👑 KazunKazun
提出日時 2021-06-05 03:36:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 76,900 KB
最終ジャッジ日時 2024-04-30 21:12:39
合計ジャッジ時間 7,319 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,592 KB
testcase_01 AC 38 ms
53,052 KB
testcase_02 AC 39 ms
52,560 KB
testcase_03 AC 65 ms
69,940 KB
testcase_04 AC 52 ms
63,528 KB
testcase_05 AC 39 ms
53,664 KB
testcase_06 AC 39 ms
52,964 KB
testcase_07 AC 39 ms
53,256 KB
testcase_08 AC 38 ms
53,504 KB
testcase_09 AC 39 ms
53,320 KB
testcase_10 AC 38 ms
53,620 KB
testcase_11 AC 39 ms
53,668 KB
testcase_12 AC 41 ms
53,572 KB
testcase_13 AC 41 ms
53,276 KB
testcase_14 AC 41 ms
53,388 KB
testcase_15 AC 41 ms
53,532 KB
testcase_16 AC 87 ms
76,368 KB
testcase_17 AC 38 ms
52,740 KB
testcase_18 AC 38 ms
53,088 KB
testcase_19 AC 40 ms
52,444 KB
testcase_20 AC 39 ms
53,824 KB
testcase_21 AC 39 ms
53,052 KB
testcase_22 AC 39 ms
52,492 KB
testcase_23 AC 40 ms
53,680 KB
testcase_24 AC 39 ms
52,632 KB
testcase_25 AC 37 ms
53,080 KB
testcase_26 AC 39 ms
53,164 KB
testcase_27 AC 39 ms
53,996 KB
testcase_28 AC 40 ms
54,252 KB
testcase_29 AC 38 ms
52,952 KB
testcase_30 AC 39 ms
53,416 KB
testcase_31 AC 39 ms
52,660 KB
testcase_32 AC 39 ms
52,608 KB
testcase_33 AC 38 ms
52,408 KB
testcase_34 AC 39 ms
53,204 KB
testcase_35 AC 38 ms
53,116 KB
testcase_36 AC 39 ms
52,004 KB
testcase_37 AC 40 ms
53,752 KB
testcase_38 AC 39 ms
52,696 KB
testcase_39 AC 39 ms
52,336 KB
testcase_40 AC 110 ms
76,900 KB
testcase_41 AC 115 ms
76,532 KB
testcase_42 AC 110 ms
76,480 KB
testcase_43 AC 106 ms
76,728 KB
testcase_44 AC 109 ms
76,720 KB
testcase_45 AC 111 ms
76,684 KB
testcase_46 AC 109 ms
76,672 KB
testcase_47 AC 110 ms
76,660 KB
testcase_48 AC 117 ms
76,716 KB
testcase_49 AC 103 ms
76,404 KB
testcase_50 AC 108 ms
76,492 KB
testcase_51 AC 114 ms
76,572 KB
testcase_52 AC 107 ms
76,540 KB
testcase_53 AC 121 ms
76,592 KB
testcase_54 AC 106 ms
76,848 KB
testcase_55 AC 111 ms
76,696 KB
testcase_56 AC 111 ms
76,484 KB
testcase_57 AC 108 ms
76,468 KB
testcase_58 AC 114 ms
76,716 KB
testcase_59 AC 111 ms
76,476 KB
testcase_60 AC 49 ms
61,484 KB
testcase_61 AC 39 ms
52,472 KB
testcase_62 AC 76 ms
74,700 KB
testcase_63 AC 52 ms
62,992 KB
testcase_64 AC 56 ms
64,760 KB
testcase_65 AC 81 ms
74,980 KB
testcase_66 AC 76 ms
75,060 KB
testcase_67 AC 81 ms
73,684 KB
testcase_68 AC 52 ms
63,336 KB
testcase_69 AC 51 ms
63,424 KB
testcase_70 AC 54 ms
64,468 KB
testcase_71 AC 38 ms
52,500 KB
testcase_72 AC 39 ms
52,944 KB
testcase_73 AC 38 ms
53,100 KB
testcase_74 AC 39 ms
52,988 KB
testcase_75 AC 39 ms
53,852 KB
testcase_76 AC 40 ms
52,792 KB
testcase_77 AC 40 ms
52,592 KB
testcase_78 AC 39 ms
53,696 KB
testcase_79 AC 60 ms
66,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
inf=float("inf")
A=[[inf]*(N+1) for _ in range(N+1)]

for _ in range(M):
    s,t,d=map(int,input().split())
    A[s][t]=min(A[s][t],d)

for i in range(1,N+1): A[i][i]=0

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

for i in range(1,N+1):
    X=0
    for j in range(1,N+1):
        if i!=j and A[i][j]<inf:
            X+=A[i][j]
    print(X)
0