結果

問題 No.1344 Typical Shortest Path Sum
ユーザー dot_haraaidot_haraai
提出日時 2021-05-31 00:25:04
言語 Nim
(2.0.2)
結果
RE  
実行時間 -
コード長 1,034 bytes
コンパイル時間 3,770 ms
コンパイル使用メモリ 87,644 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 07:57:47
合計ジャッジ時間 5,787 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 2 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
6,940 KB
testcase_09 RE -
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 RE -
testcase_15 AC 2 ms
6,940 KB
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 2 ms
6,944 KB
testcase_23 RE -
testcase_24 WA -
testcase_25 AC 1 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 1 ms
6,944 KB
testcase_28 RE -
testcase_29 AC 1 ms
6,940 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1 ms
6,940 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 WA -
testcase_38 AC 2 ms
6,940 KB
testcase_39 WA -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 1 ms
6,940 KB
testcase_62 AC 3 ms
6,940 KB
testcase_63 AC 2 ms
6,940 KB
testcase_64 AC 2 ms
6,940 KB
testcase_65 AC 4 ms
6,940 KB
testcase_66 AC 3 ms
6,940 KB
testcase_67 AC 3 ms
6,944 KB
testcase_68 AC 2 ms
6,940 KB
testcase_69 AC 2 ms
6,940 KB
testcase_70 RE -
testcase_71 WA -
testcase_72 AC 2 ms
6,940 KB
testcase_73 AC 2 ms
6,944 KB
testcase_74 WA -
testcase_75 WA -
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 18) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated]
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'times' [UnusedImport]
/home/judge/data/code/Main.nim(2, 37) Warning: imported and not used: 'deques' [UnusedImport]
/home/judge/data/code/Main.nim(2, 26) Warning: imported and not used: 'strformat' [UnusedImport]
/home/judge/data/code/Main.nim(2, 44) Warning: imported and not used: 'heapqueue' [UnusedImport]
/home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'algorithm' [UnusedImport]
/home/judge/data/code/Main.nim(1, 52) Warning: imported and not used: 'tables' [UnusedImport]
/home/judge/data/code/Main.nim(1, 60) Warning: imported and not used: 'sets' [UnusedImport]
/home/judge/data/code/Main.nim(1, 66) Warning: imported and not used: 'lists' [UnusedImport]
/home/judge/data/code/Main.nim(1, 73) Warning: imported and not used: 'intsets' [UnusedImport]
/home/judge/data/code/Main.nim(2, 8) Warning: imported and not used: 'critbits' [UnusedImport]
/home/judge/data/code/Main.nim(2, 18) Warning: imported and not used: 'future' [UnusedImport]

ソースコード

diff #

import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets
import critbits, future, strformat, deques,heapqueue
template `max=`(x,y) = x = max(x,y)
template `min=`(x,y) = x = min(x,y)
template `mod=`(x,y) = x = x mod y
template scan2 = (scan(), scan())
template scan3 = (scan(), scan())
let read* = iterator: string {.closure.} =
    while true: (for s in stdin.readLine.split: yield s)
proc scan(): int = read().parseInt
proc scanf(): float = read().parseFloat
proc toInt(c:char): int =
    return int(c) - int('0')



proc solve()=
  var
    n = scan()
    m = scan()
    d = newseqwith(n,newseqwith(n,int.high.div(4)))
  for i in 0..<m:
    var
      (a,b,dist) = (scan()-1,scan()-1,scan())
    d[a][b].min=dist

  for i in 0..<n:
    d[i][i]=0


  proc warshall_floyd()=
    
    for k in 0..<n:
      for i in 0..<n:
        for j in 0..<n:
          d[i][j]=min(d[i][j],d[i][k]+d[k][j])
  warshall_floyd()
  #echo d.join("\n")
  for i in 0..<n:
    echo d[i].filterIt(it!=int.high.div(4)).sum()


  
solve()
0