結果

問題 No.11 カードマッチ
ユーザー zazaboonzazaboon
提出日時 2017-02-05 13:30:37
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 23,284 KB
最終ジャッジ日時 2023-08-25 20:25:56
合計ジャッジ時間 3,114 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,124 KB
testcase_01 AC 79 ms
15,140 KB
testcase_02 WA -
testcase_03 AC 79 ms
15,184 KB
testcase_04 AC 130 ms
21,076 KB
testcase_05 AC 78 ms
15,080 KB
testcase_06 AC 145 ms
23,284 KB
testcase_07 AC 82 ms
15,748 KB
testcase_08 AC 111 ms
19,032 KB
testcase_09 AC 150 ms
23,188 KB
testcase_10 AC 133 ms
21,256 KB
testcase_11 AC 124 ms
20,052 KB
testcase_12 AC 124 ms
20,380 KB
testcase_13 AC 114 ms
19,200 KB
testcase_14 AC 118 ms
19,516 KB
testcase_15 AC 80 ms
15,452 KB
testcase_16 AC 81 ms
15,600 KB
testcase_17 AC 81 ms
15,360 KB
testcase_18 AC 81 ms
15,608 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+1)
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