結果

問題 No.606 カラフルタイル
ユーザー letrangerjpletrangerjp
提出日時 2017-12-06 22:36:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 459 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 11,132 KB
実行使用メモリ 30,284 KB
最終ジャッジ日時 2023-08-19 10:03:08
合計ジャッジ時間 8,844 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,152 KB
testcase_01 AC 81 ms
15,276 KB
testcase_02 AC 83 ms
16,728 KB
testcase_03 AC 81 ms
15,164 KB
testcase_04 AC 81 ms
15,048 KB
testcase_05 AC 81 ms
15,048 KB
testcase_06 AC 81 ms
15,084 KB
testcase_07 AC 83 ms
15,060 KB
testcase_08 AC 84 ms
15,092 KB
testcase_09 AC 84 ms
15,148 KB
testcase_10 AC 83 ms
15,088 KB
testcase_11 AC 84 ms
15,520 KB
testcase_12 AC 85 ms
15,052 KB
testcase_13 AC 109 ms
16,140 KB
testcase_14 AC 83 ms
16,848 KB
testcase_15 AC 84 ms
15,048 KB
testcase_16 AC 342 ms
27,064 KB
testcase_17 AC 456 ms
29,340 KB
testcase_18 AC 374 ms
27,836 KB
testcase_19 AC 362 ms
27,768 KB
testcase_20 AC 459 ms
30,284 KB
testcase_21 AC 366 ms
28,724 KB
testcase_22 AC 369 ms
28,500 KB
testcase_23 AC 377 ms
28,740 KB
testcase_24 AC 428 ms
29,612 KB
testcase_25 AC 428 ms
30,156 KB
testcase_26 AC 442 ms
30,100 KB
testcase_27 AC 446 ms
30,184 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K, Q = gets.split.map &:to_i
rows = [false] * N
cols = rows.dup
row_count = col_count = 0
colors = [0] * K
ABC = $<.map{|s|
  a, *bc = s.split
  b, c = bc.map(&:to_i).map(&:pred)
  [a, b, c]
}
ABC.reverse_each{|a,b,c|
  if a == ?R
    next if rows[b]
    rows[b] = c
    row_count += 1
    colors[c] += N - col_count
  else
    next if cols[b]
    cols[b] = c
    col_count += 1
    colors[c] += N - row_count
  end
}
colors[0] = N**2-colors[1..-1].sum
puts colors
0