結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
syokeinin
|
| 提出日時 | 2014-12-24 02:08:13 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 5,000 ms |
| コード長 | 776 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-12-31 11:05:20 |
| 合計ジャッジ時間 | 4,228 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
Syntax OK
ソースコード
gets.to_i
w_list = gets.to_s.split(" ").map(&:to_i).sort{|a, b| b <=> a}.uniq.map{|n| ["W", n] }
gets.to_i
b_list = gets.to_s.split(" ").map(&:to_i).sort{|a, b| b <=> a}.uniq.map{|n| ["B", n] }
result_list = (w_list + b_list)
(w_list + b_list).sort{|a, b| b[1] <=> a[1]}.each_cons(2){|n1, n2| result_list.push ["WB",n1[1]] if n1[1] == n2[1]}
result_list.sort!{ |a, b| b[0].length + b[1] <=> a[0].length + a[1] }.uniq!{|n| n[1]}
#p result_list
count = 1
result_list.each_cons(2) do |n1, n2|
#p "#{n1} #{n2}"
if n2[0].eql? "WB"
#p "tr"
n2[0] = n1[0].tr("WB", "BW")
count += 1
elsif !(n1[0].eql? n2[0])
#p "count"
count += 1
elsif (n1[0].eql?("WB") && n2[0].eql?("WB"))
#p "count"
count += 1
end
end if result_list.length != 1
p count
syokeinin