結果

問題 No.606 カラフルタイル
ユーザー mamekinmamekin
提出日時 2018-01-13 13:03:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 1,141 bytes
コンパイル時間 1,464 ms
コンパイル使用メモリ 109,572 KB
実行使用メモリ 5,256 KB
最終ジャッジ日時 2023-08-25 15:11:11
合計ジャッジ時間 5,449 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 6 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 40 ms
4,380 KB
testcase_17 AC 189 ms
4,952 KB
testcase_18 AC 48 ms
4,488 KB
testcase_19 AC 47 ms
4,376 KB
testcase_20 AC 194 ms
4,832 KB
testcase_21 AC 49 ms
4,432 KB
testcase_22 AC 51 ms
4,428 KB
testcase_23 AC 74 ms
4,376 KB
testcase_24 AC 150 ms
4,880 KB
testcase_25 AC 190 ms
4,824 KB
testcase_26 AC 181 ms
4,836 KB
testcase_27 AC 189 ms
5,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(q), b(q), c(q);
    for(int i=0; i<q; ++i){
        char tmp;
        cin >> tmp >> b[i] >> c[i];
        a[i] = (tmp=='R')?0:1;
        -- b[i];
        -- c[i];
    }

    vector<long long> ans(k, 0);
    vector<int> cnt(2, n);
    vector<vector<bool> > used(2, vector<bool>(n, false));
    for(int i=q-1; i>=0; --i){
        if(!used[a[i]][b[i]]){
            ans[c[i]] += cnt[a[i]^1];
            -- cnt[a[i]];
            used[a[i]][b[i]] = true;
        }
    }
    ans[0] = n * (long long)n - accumulate(ans.begin()+1, ans.end(), 0LL);
    for(int i=0; i<k; ++i)
        cout << ans[i] << endl;

    return 0;
}
0