結果

問題 No.606 カラフルタイル
ユーザー SouthTokyoGPSouthTokyoGP
提出日時 2017-12-24 00:32:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 461 ms / 2,000 ms
コード長 461 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 62,208 KB
最終ジャッジ日時 2024-05-09 22:29:38
合計ジャッジ時間 8,212 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
12,288 KB
testcase_01 AC 83 ms
12,288 KB
testcase_02 AC 81 ms
12,160 KB
testcase_03 AC 80 ms
12,160 KB
testcase_04 AC 78 ms
12,032 KB
testcase_05 AC 76 ms
12,032 KB
testcase_06 AC 77 ms
12,032 KB
testcase_07 AC 74 ms
12,032 KB
testcase_08 AC 75 ms
12,160 KB
testcase_09 AC 77 ms
12,160 KB
testcase_10 AC 75 ms
12,160 KB
testcase_11 AC 76 ms
12,288 KB
testcase_12 AC 74 ms
12,288 KB
testcase_13 AC 102 ms
15,360 KB
testcase_14 AC 75 ms
12,032 KB
testcase_15 AC 80 ms
12,160 KB
testcase_16 AC 328 ms
49,408 KB
testcase_17 AC 445 ms
61,056 KB
testcase_18 AC 366 ms
54,400 KB
testcase_19 AC 359 ms
53,632 KB
testcase_20 AC 460 ms
60,544 KB
testcase_21 AC 371 ms
54,016 KB
testcase_22 AC 359 ms
53,760 KB
testcase_23 AC 375 ms
53,248 KB
testcase_24 AC 430 ms
58,112 KB
testcase_25 AC 448 ms
55,936 KB
testcase_26 AC 461 ms
62,208 KB
testcase_27 AC 451 ms
60,928 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