結果

問題 No.92 逃走経路
ユーザー simansiman
提出日時 2015-04-02 21:10:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 372 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 66 ms
コンパイル使用メモリ 11,192 KB
実行使用メモリ 21,656 KB
最終ジャッジ日時 2023-08-27 05:31:55
合計ジャッジ時間 4,421 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 181 ms
19,168 KB
testcase_01 AC 83 ms
15,276 KB
testcase_02 AC 85 ms
15,088 KB
testcase_03 AC 86 ms
15,188 KB
testcase_04 AC 83 ms
15,048 KB
testcase_05 AC 126 ms
15,324 KB
testcase_06 AC 87 ms
15,396 KB
testcase_07 AC 87 ms
15,308 KB
testcase_08 AC 86 ms
15,264 KB
testcase_09 AC 347 ms
18,944 KB
testcase_10 AC 250 ms
21,656 KB
testcase_11 AC 279 ms
20,328 KB
testcase_12 AC 372 ms
17,764 KB
testcase_13 AC 155 ms
18,020 KB
testcase_14 AC 176 ms
18,980 KB
testcase_15 AC 227 ms
19,892 KB
testcase_16 AC 162 ms
18,380 KB
testcase_17 AC 163 ms
18,952 KB
testcase_18 AC 117 ms
17,128 KB
testcase_19 AC 96 ms
16,020 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - k
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    n, m, k = gets.chomp.split(' ').map(&:to_i)
    paths = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = []}}

    m.times do
      a, b, c = gets.chomp.split(' ').map(&:to_i)
      paths[a][c] << b
      paths[b][c] << a
    end

    d = gets.chomp.split(' ').map(&:to_i)

    current = [*(1..n)]

    d.each do |cost|
      temp = []

      current.each do |i|
        temp |= paths[i][cost]
      end

      current = temp.dup
    end

    puts current.size
    puts current.sort.join(' ')
  end
end

Yukicoder.new
0