結果

問題 No.517 壊れたアクセサリー
ユーザー cielciel
提出日時 2017-05-30 01:14:47
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 335 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 11,944 KB
実行使用メモリ 16,160 KB
最終ジャッジ日時 2023-10-21 17:02:38
合計ジャッジ時間 2,582 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 85 ms
16,120 KB
testcase_02 AC 85 ms
16,120 KB
testcase_03 RE -
testcase_04 AC 84 ms
16,120 KB
testcase_05 AC 89 ms
16,116 KB
testcase_06 AC 80 ms
16,120 KB
testcase_07 AC 83 ms
16,120 KB
testcase_08 AC 85 ms
16,124 KB
testcase_09 RE -
testcase_10 AC 83 ms
16,120 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 81 ms
16,120 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 79 ms
16,120 KB
testcase_17 AC 80 ms
16,120 KB
testcase_18 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
a,b=2.times.map{
	gets.to_i.times.map{gets.chomp}
}
prefix=a.map{|e|e[0]}&b.map{|e|e[0]}
(p -1;exit)if prefix.size>1
prefix=prefix[0]
s=a.find{|e|e[0]==prefix}
t=b.find{|e|e[0]==prefix}
while s.size!=t.size
	s+=a.find{|e|e[0]==t[s.size]} while s.size<t.size
	t+=a.find{|e|e[0]==s[t.size]} while s.size>t.size
end
puts s
0