結果

問題 No.606 カラフルタイル
ユーザー ei1333333ei1333333
提出日時 2017-12-06 12:52:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 912 bytes
コンパイル時間 1,811 ms
コンパイル使用メモリ 202,468 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-06 16:51:45
合計ジャッジ時間 4,266 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 1 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 5 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 42 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 49 ms
6,940 KB
testcase_19 AC 47 ms
6,940 KB
testcase_20 WA -
testcase_21 AC 52 ms
6,944 KB
testcase_22 AC 50 ms
6,944 KB
testcase_23 AC 75 ms
6,940 KB
testcase_24 AC 151 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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]] - rowlazy > 0) {
        ans[C[i]] += row[B[i]] - rowlazy;
        row[B[i]] = 0;
        ++collazy;
      }
    } else {
      if(col[B[i]] - collazy > 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