結果

問題 No.110 しましまピラミッド
ユーザー syokeininsyokeinin
提出日時 2014-12-24 02:08:13
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 776 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 11,616 KB
実行使用メモリ 15,312 KB
最終ジャッジ日時 2023-08-30 03:46:37
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,312 KB
testcase_01 AC 82 ms
15,232 KB
testcase_02 AC 82 ms
15,124 KB
testcase_03 AC 82 ms
15,228 KB
testcase_04 AC 82 ms
15,272 KB
testcase_05 AC 87 ms
15,264 KB
testcase_06 AC 81 ms
15,224 KB
testcase_07 AC 82 ms
15,124 KB
testcase_08 AC 81 ms
15,084 KB
testcase_09 AC 82 ms
15,060 KB
testcase_10 AC 81 ms
15,256 KB
testcase_11 AC 82 ms
15,128 KB
testcase_12 AC 82 ms
15,284 KB
testcase_13 AC 82 ms
15,204 KB
testcase_14 AC 82 ms
15,196 KB
testcase_15 AC 82 ms
15,104 KB
testcase_16 AC 81 ms
15,124 KB
testcase_17 AC 82 ms
15,184 KB
testcase_18 AC 82 ms
15,120 KB
testcase_19 AC 82 ms
15,292 KB
testcase_20 AC 81 ms
15,120 KB
testcase_21 AC 81 ms
15,224 KB
testcase_22 AC 81 ms
15,272 KB
testcase_23 AC 81 ms
15,140 KB
testcase_24 AC 82 ms
15,264 KB
testcase_25 AC 81 ms
15,268 KB
testcase_26 AC 81 ms
15,124 KB
testcase_27 AC 81 ms
15,152 KB
testcase_28 AC 81 ms
15,036 KB
testcase_29 AC 81 ms
15,132 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
0