結果
問題 | No.11 カードマッチ |
ユーザー | DialBird |
提出日時 | 2016-11-16 10:27:18 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 104 ms / 5,000 ms |
コード長 | 355 bytes |
コンパイル時間 | 226 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 27,776 KB |
最終ジャッジ日時 | 2024-11-26 02:10:56 |
合計ジャッジ時間 | 2,743 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
Main.rb:13: warning: assigned but unused variable - ans Syntax OK
ソースコード
def main w = gets.to_i h = gets.to_i n = gets.to_i w_list = [nil]*(w+1) h_list = [nil]*(h+1) n.times do s,k = gets.split.map(&:to_i) w_list[s] = true if w_list[s].nil? h_list[k] = true if h_list[k].nil? end not_used = (w - (w_list.compact!.length)) * (h - (h_list.compact!.length)) ans = w * h - not_used - n end puts main()