結果

問題 No.606 カラフルタイル
ユーザー t98slidert98slider
提出日時 2023-02-04 19:11:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 1,622 ms
コンパイル使用メモリ 176,260 KB
実行使用メモリ 5,160 KB
最終ジャッジ日時 2023-09-16 15:41:22
合計ジャッジ時間 4,074 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 16 ms
4,380 KB
testcase_17 AC 26 ms
5,096 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 AC 17 ms
4,468 KB
testcase_20 AC 27 ms
5,160 KB
testcase_21 AC 18 ms
4,380 KB
testcase_22 AC 18 ms
4,380 KB
testcase_23 AC 21 ms
4,520 KB
testcase_24 AC 25 ms
4,824 KB
testcase_25 AC 25 ms
5,156 KB
testcase_26 AC 26 ms
5,092 KB
testcase_27 AC 26 ms
5,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k, q, x, c, p;
    cin >> n >> k >> q;
    int X = n, Y = n;
    vector<tuple<int,int,int>> query(q);
    vector<bool> used(n + n);
    vector<ll> ans(k);
    char t;
    for(int i = 0; i < q; i++){
        cin >> t >> x >> c;
        query[i] = make_tuple(t == 'C', x - 1, c - 1);
    }
    reverse(query.begin(), query.end());
    for(int i = 0; i < q; i++){
        tie(p, x, c) = query[i];
        x += p == 1 ? n : 0;
        if(used[x])continue;
        used[x] = true;
        if(p){
            ans[c] += Y;
            X--;
        }else{
            ans[c] += X;
            Y--;
        }
    }
    ans[0] += (ll)X * Y;
    for(auto &&v:ans)cout << v << '\n';
}
0