結果

問題 No.11 カードマッチ
ユーザー nakamura sosukenakamura sosuke
提出日時 2019-07-16 18:20:12
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 419 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 668,484 KB
最終ジャッジ日時 2023-08-21 02:17:36
合計ジャッジ時間 7,776 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
19,556 KB
testcase_01 AC 79 ms
15,160 KB
testcase_02 RE -
testcase_03 AC 78 ms
15,044 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

W = gets.to_i
H = gets.to_i
N = gets.to_i
SK = N.times.map{ gets.split.map(&:to_i) }

# cards: マークの数を配列長
cs = Array.new(W){ Array.new(H){ false } }
SK.each do | s, k |
  # マークs
  0.upto(H-1) do | i |
    cs[s][i] = true
  end
  # マークs以外
  0.upto(W-1) do | j |
    cs[j][k] = true
  end
end
SK.each do | s, k |
  cs[s][k] = false
end

sum = 0
cs.each{ | c | sum += c.count(true) }
p sum
0