結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2014-12-24 02:14:16 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 101 ms / 5,000 ms |
コード長 | 855 bytes |
コンパイル時間 | 257 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-12-31 11:05:28 |
合計ジャッジ時間 | 4,224 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
コンパイルメッセージ
Syntax OK
ソースコード
gets.to_iw_list = gets.to_s.split(" ").map(&:to_i).sort{|a, b| b <=> a}.uniq.map{|n| ["W", n] }gets.to_ib_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! do |a, b|result = 0result = b[0].length + b[1] <=> a[0].length + a[1]result = b[1] <=> a[1] if result == 0resultend.uniq!{|n| n[1]}#p result_listcount = 1result_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 += 1elsif !(n1[0].eql? n2[0])#p "count"count += 1elsif (n1[0].eql?("WB") && n2[0].eql?("WB"))#p "count"count += 1endend if result_list.length != 1p count