結果

問題 No.11 カードマッチ
ユーザー zazaboonzazaboon
提出日時 2017-02-05 13:29:54
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 384 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 11,196 KB
実行使用メモリ 23,396 KB
最終ジャッジ日時 2023-08-25 20:25:52
合計ジャッジ時間 3,686 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,168 KB
testcase_01 AC 78 ms
15,184 KB
testcase_02 RE -
testcase_03 AC 80 ms
15,012 KB
testcase_04 AC 132 ms
21,000 KB
testcase_05 RE -
testcase_06 AC 150 ms
23,236 KB
testcase_07 AC 86 ms
15,584 KB
testcase_08 AC 112 ms
18,804 KB
testcase_09 AC 150 ms
23,396 KB
testcase_10 AC 132 ms
21,084 KB
testcase_11 AC 124 ms
20,284 KB
testcase_12 AC 124 ms
20,284 KB
testcase_13 AC 115 ms
19,072 KB
testcase_14 AC 121 ms
19,372 KB
testcase_15 AC 83 ms
15,372 KB
testcase_16 AC 82 ms
15,384 KB
testcase_17 AC 81 ms
15,532 KB
testcase_18 AC 81 ms
15,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

w = gets.to_i
h = gets.to_i
n = gets.to_i
t = []
n.times do 
  t.push(gets.chomp.split(" ").map(&:to_i))
end
tt = Array.new(w)
tt.fill(0)
t.map{|u|u[0]}.each do |d|
  tt[d] += 1
end 
a = 0
m = []
mm = []
w.times do |d|
  unless(tt[d] == 0)
    p = h - tt[d]
    a += p 
    m.push(d)
    mm.push(t.map{|u|u[1]})
  end 
end
m.uniq!
mm = mm.flatten.uniq
a += mm.size * (w - m.size) 
p a
0