結果

問題 No.11 カードマッチ
ユーザー zazaboonzazaboon
提出日時 2017-02-05 13:32:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 154 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 23,400 KB
最終ジャッジ日時 2023-08-25 20:26:00
合計ジャッジ時間 2,978 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,008 KB
testcase_01 AC 81 ms
15,092 KB
testcase_02 AC 79 ms
15,300 KB
testcase_03 AC 79 ms
15,120 KB
testcase_04 AC 131 ms
21,112 KB
testcase_05 AC 84 ms
15,040 KB
testcase_06 AC 150 ms
23,400 KB
testcase_07 AC 84 ms
15,632 KB
testcase_08 AC 111 ms
18,884 KB
testcase_09 AC 154 ms
23,400 KB
testcase_10 AC 131 ms
20,964 KB
testcase_11 AC 122 ms
20,020 KB
testcase_12 AC 123 ms
20,360 KB
testcase_13 AC 113 ms
19,080 KB
testcase_14 AC 118 ms
19,396 KB
testcase_15 AC 83 ms
15,628 KB
testcase_16 AC 84 ms
15,448 KB
testcase_17 AC 82 ms
15,424 KB
testcase_18 AC 83 ms
15,456 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] += 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