結果

問題 No.11 カードマッチ
ユーザー simansiman
提出日時 2016-03-27 03:19:49
言語 Ruby
(3.3.0)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 556 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 20,096 KB
最終ジャッジ日時 2024-04-20 01:14:51
合計ジャッジ時間 3,246 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
12,288 KB
testcase_01 AC 88 ms
12,160 KB
testcase_02 AC 87 ms
12,032 KB
testcase_03 AC 89 ms
12,288 KB
testcase_04 AC 158 ms
18,048 KB
testcase_05 AC 88 ms
12,288 KB
testcase_06 AC 180 ms
20,096 KB
testcase_07 AC 91 ms
12,288 KB
testcase_08 AC 129 ms
15,616 KB
testcase_09 AC 182 ms
19,968 KB
testcase_10 AC 158 ms
18,176 KB
testcase_11 AC 147 ms
17,024 KB
testcase_12 AC 146 ms
17,152 KB
testcase_13 AC 133 ms
16,000 KB
testcase_14 AC 141 ms
16,384 KB
testcase_15 AC 89 ms
12,032 KB
testcase_16 AC 89 ms
12,160 KB
testcase_17 AC 90 ms
12,288 KB
testcase_18 AC 90 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

    marks = Array.new(w, false)
    nums = Hash.new(false)
    sum = 0

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

      if !marks[s]
        marks[s] = true
      end

      if !nums[k]
        nums[k] = true
        sum += 1
      end
    end

    answer = 0

    marks.each do |mark|
      num = 0

      if mark
        num += h
      else
        num += sum
      end

      answer += num
    end

    puts answer - n
  end
end

Yukicoder.new
0