結果

問題 No.110 しましまピラミッド
ユーザー simansiman
提出日時 2015-01-14 03:31:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 1,179 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 11,436 KB
実行使用メモリ 15,312 KB
最終ジャッジ日時 2023-08-30 03:46:57
合計ジャッジ時間 3,803 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,288 KB
testcase_01 AC 83 ms
15,220 KB
testcase_02 AC 82 ms
15,272 KB
testcase_03 AC 81 ms
15,112 KB
testcase_04 AC 81 ms
15,256 KB
testcase_05 AC 82 ms
15,080 KB
testcase_06 AC 83 ms
15,168 KB
testcase_07 AC 81 ms
15,280 KB
testcase_08 AC 81 ms
15,228 KB
testcase_09 AC 81 ms
15,172 KB
testcase_10 AC 81 ms
15,152 KB
testcase_11 AC 82 ms
15,288 KB
testcase_12 AC 82 ms
15,104 KB
testcase_13 AC 82 ms
15,060 KB
testcase_14 AC 83 ms
15,272 KB
testcase_15 AC 83 ms
15,152 KB
testcase_16 AC 83 ms
15,052 KB
testcase_17 AC 82 ms
15,164 KB
testcase_18 AC 82 ms
15,292 KB
testcase_19 AC 82 ms
15,224 KB
testcase_20 AC 83 ms
15,080 KB
testcase_21 AC 81 ms
15,032 KB
testcase_22 AC 82 ms
15,148 KB
testcase_23 AC 82 ms
15,220 KB
testcase_24 AC 81 ms
15,180 KB
testcase_25 AC 82 ms
15,284 KB
testcase_26 AC 82 ms
15,312 KB
testcase_27 AC 81 ms
15,132 KB
testcase_28 AC 81 ms
15,124 KB
testcase_29 AC 82 ms
15,232 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    n = gets.chomp.to_i
    w = gets.chomp.split(' ').map(&:to_i).sort
    n = gets.chomp.to_i
    b = gets.chomp.split(' ').map(&:to_i).sort

    dw = w.dup
    db = b.dup
    listA = []
    listB = []
    number = 0

    while w.any? || b.any?
      if listA.size.even?
        if w.first.to_i > number
          number = w.shift
          listA << number
        elsif w.empty?
          break;
        else
          w.shift
        end
      else
        if b.first.to_i > number
          number = b.shift
          listA << number
        elsif b.empty?
          break
        else
          b.shift
        end
      end
    end

    number = 0

    while dw.any? || db.any?
      if listB.size.odd?
        if dw.first.to_i > number
          number = dw.shift
          listB << number
        elsif dw.empty?
          break;
        else
          dw.shift
        end
      else
        if db.first.to_i > number
          number = db.shift
          listB << number
        elsif db.empty?
          break
        else
          db.shift
        end
      end
    end

    puts [listA.size, listB.size].max
  end
end

Yukicoder.new
0