結果

問題 No.11 カードマッチ
ユーザー siman
提出日時 2016-03-27 03:09:39
言語 Ruby
(3.4.1)
結果
MLE  
実行時間 -
コード長 587 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 816,768 KB
最終ジャッジ日時 2024-10-02 01:41:41
合計ジャッジ時間 3,722 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 MLE * 1 -- * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    w = gets.to_i
    h = gets.to_i
    n = gets.to_i

    marks = Array.new(w){ Array.new(h, 0)}
    nums = Hash.new(0)
    check_list = Hash.new(false)

    n.times do
      s, k = gets.chomp.split.map{|i| i.to_i-1}

      if !check_list[s]
        marks[s] = Array.new(h, 1)
        check_list[s] = true
      end

      nums[k] = 1
    end

    answer = 0

    marks.each do |mark|
      num = 0

      mark.each_with_index do |n, i|
        num += [n, nums[i]].max
      end

      answer += num
    end

    puts answer - n
  end
end

Yukicoder.new
0