結果

問題 No.11 カードマッチ
ユーザー DialBirdDialBird
提出日時 2017-02-12 19:10:29
言語 Ruby
(3.3.0)
結果
AC  
実行時間 98 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 30,800 KB
最終ジャッジ日時 2023-08-28 14:53:49
合計ジャッジ時間 2,780 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,132 KB
testcase_01 AC 85 ms
15,216 KB
testcase_02 AC 79 ms
15,120 KB
testcase_03 AC 80 ms
15,040 KB
testcase_04 AC 86 ms
21,668 KB
testcase_05 AC 78 ms
15,272 KB
testcase_06 AC 98 ms
30,612 KB
testcase_07 AC 87 ms
20,372 KB
testcase_08 AC 90 ms
23,500 KB
testcase_09 AC 97 ms
30,800 KB
testcase_10 AC 93 ms
27,764 KB
testcase_11 AC 94 ms
26,644 KB
testcase_12 AC 91 ms
26,976 KB
testcase_13 AC 91 ms
26,120 KB
testcase_14 AC 85 ms
20,900 KB
testcase_15 AC 77 ms
15,068 KB
testcase_16 AC 81 ms
15,816 KB
testcase_17 AC 81 ms
15,712 KB
testcase_18 AC 81 ms
15,644 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

W = gets.to_i
H = gets.to_i
N = gets.to_i

w_list = Array.new(W, false)
h_list = Array.new(H, false)

N.times do
  s,k = gets.chomp.split.map(&:to_i)
  w_list[s - 1] = true
  h_list[k - 1] = true
end

w_not_used_count = w_list.count(false)
h_not_used_count = h_list.count(false)

puts (W * H) - (w_not_used_count * h_not_used_count) - N
0