結果

問題 No.606 カラフルタイル
ユーザー face4face4
提出日時 2019-03-02 17:52:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 72,216 KB
実行使用メモリ 4,860 KB
最終ジャッジ日時 2023-09-05 16:55:56
合計ジャッジ時間 4,210 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 5 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 40 ms
4,380 KB
testcase_17 AC 191 ms
4,540 KB
testcase_18 AC 49 ms
4,516 KB
testcase_19 AC 48 ms
4,380 KB
testcase_20 AC 194 ms
4,584 KB
testcase_21 AC 49 ms
4,376 KB
testcase_22 AC 49 ms
4,376 KB
testcase_23 AC 74 ms
4,556 KB
testcase_24 AC 147 ms
4,460 KB
testcase_25 AC 192 ms
4,604 KB
testcase_26 AC 194 ms
4,780 KB
testcase_27 AC 195 ms
4,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<numeric>
using namespace std;

typedef long long ll;

int main(){
    int n, k, q;
    cin >> n >> k >> q;
    int row = n, col = n;
    char a[q];
    int b[q], c[q];
    for(int i = 0; i < q; i++)  cin >> a[i] >> b[i] >> c[i];
    vector<ll> ans(k, 0);
    vector<bool> rowb(n, 0), colb(n, 0);
    for(int i = q-1; i >= 0; i--){
        if(a[i] == 'R'){
            if(rowb[b[i]-1])    continue;
            rowb[b[i]-1] = true;
            ans[c[i]-1] += col;
            row--;
        }else if(a[i] == 'C'){
            if(colb[b[i]-1])    continue;
            colb[b[i]-1] = true;
            ans[c[i]-1] += row;
            col--;
        }
    }
    ans[0] += (ll)n*n - accumulate(ans.begin(), ans.end(), 0ll);
    for(int i = 0; i < k; i++)  cout << ans[i] << endl;
    return 0;
}
0