結果

問題 No.606 カラフルタイル
ユーザー ふーらくたるふーらくたる
提出日時 2017-12-07 22:37:23
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 993 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 11,508 KB
最終ジャッジ日時 2023-08-19 12:29:53
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,616 KB
testcase_01 AC 4 ms
9,608 KB
testcase_02 AC 4 ms
9,688 KB
testcase_03 AC 4 ms
9,612 KB
testcase_04 AC 4 ms
9,620 KB
testcase_05 AC 4 ms
9,728 KB
testcase_06 AC 4 ms
9,592 KB
testcase_07 AC 4 ms
9,616 KB
testcase_08 AC 4 ms
9,760 KB
testcase_09 AC 4 ms
9,628 KB
testcase_10 AC 4 ms
9,668 KB
testcase_11 AC 4 ms
9,756 KB
testcase_12 AC 5 ms
9,624 KB
testcase_13 AC 6 ms
9,716 KB
testcase_14 AC 4 ms
9,640 KB
testcase_15 AC 4 ms
9,904 KB
testcase_16 AC 21 ms
10,668 KB
testcase_17 AC 32 ms
11,360 KB
testcase_18 AC 22 ms
10,500 KB
testcase_19 AC 22 ms
10,536 KB
testcase_20 AC 35 ms
11,508 KB
testcase_21 AC 25 ms
10,716 KB
testcase_22 AC 25 ms
10,596 KB
testcase_23 AC 30 ms
10,792 KB
testcase_24 AC 32 ms
11,048 KB
testcase_25 AC 32 ms
10,388 KB
testcase_26 AC 34 ms
11,264 KB
testcase_27 AC 34 ms
11,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

using int64 = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int64 N;
    int K, Q;
    cin >> N >> K >> Q;

    map<string, int> mp;
    mp["R"] = 0;
    mp["C"] = 1;

    const int maxq = 200000;
    const int maxn = 200000;
    const int maxk = 200000;

    static string A[maxq];
    static int B[maxq], C[maxq];

    static bool used[2][maxn];
    static int64 ans[maxk];
    for (int i = 0; i < Q; i++) {
        cin >> A[i] >> B[i] >> C[i];
        B[i]--; C[i]--;
    }

    int64 cnt[2] = {0, 0};
    for (int i = Q - 1; i >= 0; i--) {
        int rc = mp[A[i]];
        if (used[rc][B[i]]) continue;

        used[rc][B[i]] = true;
        ans[C[i]] += N - cnt[rc ^ 1];
        cnt[rc]++;
    }

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

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

    return 0;
}
0