結果

問題 No.606 カラフルタイル
ユーザー SouthTokyoGPSouthTokyoGP
提出日時 2017-12-24 00:32:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 62,628 KB
最終ジャッジ日時 2023-08-22 16:41:20
合計ジャッジ時間 9,369 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,264 KB
testcase_01 AC 79 ms
15,244 KB
testcase_02 AC 79 ms
15,336 KB
testcase_03 AC 79 ms
15,260 KB
testcase_04 AC 79 ms
15,176 KB
testcase_05 AC 78 ms
15,184 KB
testcase_06 AC 80 ms
15,160 KB
testcase_07 AC 79 ms
15,172 KB
testcase_08 AC 80 ms
15,040 KB
testcase_09 AC 80 ms
15,132 KB
testcase_10 AC 81 ms
15,248 KB
testcase_11 AC 79 ms
15,292 KB
testcase_12 AC 81 ms
15,304 KB
testcase_13 AC 104 ms
18,916 KB
testcase_14 AC 80 ms
15,264 KB
testcase_15 AC 83 ms
15,180 KB
testcase_16 AC 339 ms
56,928 KB
testcase_17 AC 458 ms
61,704 KB
testcase_18 AC 378 ms
60,744 KB
testcase_19 AC 368 ms
60,420 KB
testcase_20 AC 466 ms
61,100 KB
testcase_21 AC 365 ms
60,444 KB
testcase_22 AC 370 ms
60,460 KB
testcase_23 AC 380 ms
59,584 KB
testcase_24 AC 441 ms
60,232 KB
testcase_25 AC 426 ms
58,220 KB
testcase_26 AC 467 ms
62,628 KB
testcase_27 AC 462 ms
61,836 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:12: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

def readl
  $stdin.gets.split(" ")
end

N,K,Q = readl.map{ |r| r.to_i }

rd = {}
cd = {}
color_count = (0...K).map{ 0 }

(0...Q).map{ |i| [i, *(readl)] }.reverse.each{ |l|
  i,a,b,c = l
  b = b.to_i
  c = c.to_i
  case a
  when "R"
    next if rd.key?(b)
    color_count[c-1] += N - cd.size
    rd[b] = 1
  when "C"
    next if cd.key?(b)
    color_count[c-1] += N - rd.size
    cd[b] = 1
  end
}

color_count[0] += (N - rd.size)*(N - cd.size)
puts color_count
0