結果

問題 No.606 カラフルタイル
ユーザー ei1333333ei1333333
提出日時 2017-12-06 12:55:40
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 897 bytes
コンパイル時間 2,535 ms
コンパイル使用メモリ 199,324 KB
実行使用メモリ 5,936 KB
最終ジャッジ日時 2023-08-19 09:39:28
合計ジャッジ時間 4,901 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
5,468 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
5,704 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 5 ms
4,436 KB
testcase_14 AC 2 ms
4,812 KB
testcase_15 AC 3 ms
4,384 KB
testcase_16 AC 40 ms
4,892 KB
testcase_17 AC 188 ms
5,384 KB
testcase_18 AC 48 ms
5,620 KB
testcase_19 AC 47 ms
5,340 KB
testcase_20 AC 189 ms
5,776 KB
testcase_21 AC 51 ms
5,720 KB
testcase_22 AC 49 ms
5,800 KB
testcase_23 AC 74 ms
5,684 KB
testcase_24 AC 149 ms
5,688 KB
testcase_25 AC 188 ms
5,768 KB
testcase_26 AC 187 ms
5,744 KB
testcase_27 AC 190 ms
5,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main()
{
  int N, K, Q;
  char A[100000];
  int B[100000], C[100000];
  int row[100000], rowlazy = 0;
  int col[100000], collazy = 0;
  int64 ans[100000] = {};

  cin >> N >> K >> Q;
  for(int i = 0; i < Q; i++) {
    cin >> A[i] >> B[i] >> C[i];
    --B[i], --C[i];
  }


  for(int i = 0; i < N; i++) {
    row[i] = col[i] = N;
  }
  for(int i = Q - 1; i >= 0; i--) {
    if(A[i] == 'R') {
      if(row[B[i]] > 0) {
        ans[C[i]] += row[B[i]] - rowlazy;
        row[B[i]] = 0;
        ++collazy;
      }
    } else {
      if(col[B[i]] > 0) {
        ans[C[i]] += col[B[i]] - collazy;
        col[B[i]] = 0;
        ++rowlazy;
      }
    }
  }

  int64 rest = 1LL * N * N;
  for(int i = 0; i < K; i++) {
    rest -= ans[i];
  }
  ans[0] += rest;

  for(int i = 0; i < K; i++) {
    cout << ans[i] << endl;
  }


}
0