結果

問題 No.110 しましまピラミッド
ユーザー syokeininsyokeinin
提出日時 2014-12-24 01:38:25
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 591 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 15,620 KB
最終ジャッジ日時 2023-09-02 22:42:32
合計ジャッジ時間 3,872 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 81 ms
15,272 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 83 ms
15,268 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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){count += 1 if !(n1[0].eql? n2[0]) || (n1[0].eql?("WB") && n2[0].eql?("WB"))} if result_list.length != 1 
p count
0