結果

問題 No.92 逃走経路
ユーザー gigurururugigurururu
提出日時 2014-12-07 21:39:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 377 ms / 5,000 ms
コード長 219 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 11,252 KB
実行使用メモリ 40,032 KB
最終ジャッジ日時 2023-08-27 05:21:32
合計ジャッジ時間 4,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
17,080 KB
testcase_01 AC 88 ms
15,140 KB
testcase_02 AC 82 ms
15,152 KB
testcase_03 AC 84 ms
15,048 KB
testcase_04 AC 81 ms
15,140 KB
testcase_05 AC 369 ms
40,032 KB
testcase_06 AC 91 ms
15,612 KB
testcase_07 AC 90 ms
15,620 KB
testcase_08 AC 85 ms
15,128 KB
testcase_09 AC 116 ms
17,252 KB
testcase_10 AC 365 ms
26,860 KB
testcase_11 AC 354 ms
35,032 KB
testcase_12 AC 377 ms
38,312 KB
testcase_13 AC 104 ms
17,208 KB
testcase_14 AC 105 ms
17,224 KB
testcase_15 AC 115 ms
17,048 KB
testcase_16 AC 105 ms
16,364 KB
testcase_17 AC 107 ms
16,576 KB
testcase_18 AC 99 ms
16,084 KB
testcase_19 AC 95 ms
15,768 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def g;gets.split.map(&:to_i)end
n,m=g
l=Hash.new{|h,k|h[k]=Hash.new{[]}}
m.times{
  a,b,c=g
  l[c][a]+=[b]
  l[c][b]+=[a]
}
now=*1..n
g.each{|c|now=l[c].values_at(*now).flatten.uniq}
puts now.size,now.sort*" "
0