結果

問題 No.11 カードマッチ
ユーザー zazaboonzazaboon
提出日時 2017-02-05 13:29:54
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 384 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-06-06 14:28:24
合計ジャッジ時間 2,916 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
12,160 KB
testcase_01 AC 88 ms
12,032 KB
testcase_02 RE -
testcase_03 AC 85 ms
12,160 KB
testcase_04 AC 130 ms
17,920 KB
testcase_05 RE -
testcase_06 AC 153 ms
19,840 KB
testcase_07 AC 86 ms
12,288 KB
testcase_08 AC 118 ms
15,744 KB
testcase_09 AC 158 ms
19,968 KB
testcase_10 AC 140 ms
18,048 KB
testcase_11 AC 135 ms
17,024 KB
testcase_12 AC 133 ms
17,152 KB
testcase_13 AC 120 ms
16,000 KB
testcase_14 AC 124 ms
16,256 KB
testcase_15 AC 87 ms
12,160 KB
testcase_16 AC 85 ms
12,288 KB
testcase_17 AC 88 ms
12,032 KB
testcase_18 AC 87 ms
12,288 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