結果

問題 No.11 カードマッチ
ユーザー DialBirdDialBird
提出日時 2016-11-15 21:55:33
言語 Ruby
(3.3.0)
結果
MLE  
実行時間 -
コード長 411 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 816,832 KB
最終ジャッジ日時 2023-08-17 07:07:27
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,040 KB
testcase_01 AC 81 ms
15,224 KB
testcase_02 AC 76 ms
15,304 KB
testcase_03 AC 76 ms
15,224 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def main
  w = gets.to_i
  h = gets.to_i
  n = gets.to_i
  cards = Array.new(h){Array.new(w, 0)}
  n.times do
    s,k = gets.split.map(&:to_i)
    cards[k-1][s-1] = 2
    (0...h).each do |_h|
      cards[_h][s-1] = 1 if cards[_h][s-1] != 2
    end
    (0...w).each do |_w|
      cards[k-1][_w] = 1 if cards[k-1][_w] != 2
    end
    cards[k-1][s-1] = 2
  end
  puts cards.flatten.count {|c| c == 1 }
end

main()
0