結果

問題 No.8069 Torn Documents
ユーザー cielciel
提出日時 2020-10-26 19:10:50
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 315 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-07-21 21:41:48
合計ジャッジ時間 5,721 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

a,b=gets.split.map &:to_i
s=gets.chomp.gsub(/[LR]+/){|e|e[-1]}.gsub(/[UD]+/){|e|e[-1]}
if !s.include?('L')||!s.include?('U')||s.end_with?('RD')||s.end_with?('DR')
	p -1
else
	p 6
	s=s.gsub(/[DR]/,'')
	r=[[0,1],[a+2,0],[a+1,1],[a+1,b],[a,b+1],[a-1,b]]
	r=r.map &:reverse if s.end_with?('U')
	puts r.map{|e|e*' '}
end
0