結果
問題 | No.92 逃走経路 |
ユーザー |
![]() |
提出日時 | 2015-04-02 21:10:03 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 573 ms / 5,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 51 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 30,464 KB |
最終ジャッジ日時 | 2024-12-26 14:55:09 |
合計ジャッジ時間 | 6,188 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - k Syntax OK
ソースコード
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