結果

問題 No.1344 Typical Shortest Path Sum
ユーザー googol_S0googol_S0
提出日時 2021-01-16 14:04:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 392 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 78,196 KB
最終ジャッジ日時 2023-08-18 10:45:47
合計ジャッジ時間 10,499 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,064 KB
testcase_01 AC 73 ms
71,136 KB
testcase_02 AC 73 ms
71,156 KB
testcase_03 AC 91 ms
76,480 KB
testcase_04 AC 83 ms
76,344 KB
testcase_05 AC 75 ms
71,468 KB
testcase_06 AC 75 ms
71,256 KB
testcase_07 AC 72 ms
71,112 KB
testcase_08 AC 73 ms
71,112 KB
testcase_09 AC 74 ms
71,376 KB
testcase_10 AC 70 ms
71,256 KB
testcase_11 AC 72 ms
71,332 KB
testcase_12 AC 73 ms
71,160 KB
testcase_13 AC 73 ms
71,252 KB
testcase_14 AC 73 ms
71,312 KB
testcase_15 AC 73 ms
71,144 KB
testcase_16 AC 102 ms
77,436 KB
testcase_17 AC 73 ms
71,460 KB
testcase_18 AC 73 ms
71,216 KB
testcase_19 AC 73 ms
71,256 KB
testcase_20 AC 73 ms
71,204 KB
testcase_21 AC 75 ms
71,324 KB
testcase_22 AC 72 ms
71,300 KB
testcase_23 AC 76 ms
71,100 KB
testcase_24 AC 74 ms
71,468 KB
testcase_25 AC 75 ms
71,312 KB
testcase_26 AC 73 ms
71,156 KB
testcase_27 AC 73 ms
71,256 KB
testcase_28 AC 76 ms
71,332 KB
testcase_29 AC 74 ms
71,412 KB
testcase_30 AC 75 ms
71,296 KB
testcase_31 AC 73 ms
71,376 KB
testcase_32 AC 74 ms
71,372 KB
testcase_33 AC 74 ms
71,100 KB
testcase_34 AC 72 ms
71,360 KB
testcase_35 AC 73 ms
71,240 KB
testcase_36 AC 74 ms
71,312 KB
testcase_37 AC 72 ms
70,968 KB
testcase_38 AC 73 ms
71,320 KB
testcase_39 AC 73 ms
71,116 KB
testcase_40 AC 144 ms
77,632 KB
testcase_41 AC 154 ms
77,992 KB
testcase_42 AC 141 ms
77,932 KB
testcase_43 AC 138 ms
77,908 KB
testcase_44 AC 141 ms
77,916 KB
testcase_45 AC 142 ms
77,884 KB
testcase_46 AC 144 ms
77,748 KB
testcase_47 AC 143 ms
77,832 KB
testcase_48 AC 164 ms
77,980 KB
testcase_49 AC 139 ms
77,820 KB
testcase_50 AC 140 ms
77,836 KB
testcase_51 AC 149 ms
77,920 KB
testcase_52 AC 138 ms
77,656 KB
testcase_53 AC 165 ms
77,996 KB
testcase_54 AC 138 ms
77,644 KB
testcase_55 AC 145 ms
77,744 KB
testcase_56 AC 150 ms
78,196 KB
testcase_57 AC 138 ms
78,124 KB
testcase_58 AC 151 ms
77,536 KB
testcase_59 AC 150 ms
78,100 KB
testcase_60 AC 81 ms
75,952 KB
testcase_61 AC 73 ms
71,244 KB
testcase_62 AC 110 ms
77,416 KB
testcase_63 AC 86 ms
76,292 KB
testcase_64 AC 89 ms
76,056 KB
testcase_65 AC 111 ms
77,372 KB
testcase_66 AC 111 ms
77,428 KB
testcase_67 AC 111 ms
77,604 KB
testcase_68 AC 86 ms
76,296 KB
testcase_69 AC 86 ms
76,236 KB
testcase_70 AC 89 ms
76,256 KB
testcase_71 AC 72 ms
71,176 KB
testcase_72 AC 72 ms
71,376 KB
testcase_73 AC 71 ms
71,196 KB
testcase_74 AC 73 ms
71,320 KB
testcase_75 AC 74 ms
71,196 KB
testcase_76 AC 74 ms
71,368 KB
testcase_77 AC 74 ms
71,080 KB
testcase_78 AC 73 ms
71,096 KB
testcase_79 AC 94 ms
76,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
INF=10**18
D=[[INF*10]*N for i in range(N)]
for i in range(N):
  D[i][i]=0
for i in range(M):
  s,t,d=map(int,input().split())
  D[s-1][t-1]=min(D[s-1][t-1],d)
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])
P=0
for i in range(N):
  for j in range(N):
    if D[i][j]<INF:
      P+=D[i][j]
  print(P)
  P=0
0