結果
問題 |
No.517 壊れたアクセサリー
|
ユーザー |
![]() |
提出日時 | 2017-08-20 07:19:41 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 319 bytes |
コンパイル時間 | 160 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-10-14 17:10:32 |
合計ジャッジ時間 | 2,782 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
コンパイルメッセージ
Main.rb:21: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
m={} 2.times do gets.to_i.times do s = gets.chomp s[0...-1].chars.each_with_index do |c, i| m[c] = s[i+1] end m[s[-1]] ||= nil; end end case m.to_a.map(&:last).count(nil) when 1 c = nil s = "" while m.key(c) do s << m.key(c) c = m.key(c) end puts s.reverse else puts -1 end