結果

問題 No.606 カラフルタイル
ユーザー firiexpfiriexp
提出日時 2019-12-02 13:55:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,255 bytes
コンパイル時間 857 ms
コンパイル使用メモリ 102,248 KB
実行使用メモリ 6,596 KB
最終ジャッジ日時 2023-08-15 23:54:31
合計ジャッジ時間 4,331 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,756 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 3 ms
4,384 KB
testcase_14 AC 2 ms
4,708 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 17 ms
4,384 KB
testcase_17 AC 29 ms
5,696 KB
testcase_18 AC 19 ms
4,840 KB
testcase_19 AC 18 ms
4,844 KB
testcase_20 AC 31 ms
6,448 KB
testcase_21 AC 20 ms
5,828 KB
testcase_22 AC 20 ms
5,676 KB
testcase_23 AC 23 ms
6,072 KB
testcase_24 AC 28 ms
6,164 KB
testcase_25 AC 28 ms
6,444 KB
testcase_26 AC 29 ms
6,484 KB
testcase_27 AC 29 ms
6,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <limits>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    ll n, k, q;
    cin >> n >> k >> q;
    vector<ll> ans(k);
    ll rem = n*n, cnt1 = n, cnt2 = n;
    vector<ll> used1(n), used2(n);
    vector<tuple<char, int, int>> v(q);
    for (int i = 0; i < q; ++i) {
        char x; int a, b;
        scanf(" %c %d %d", &x, &a, &b);
        v[i] = {x, a-1, b-1};
    }
    reverse(v.begin(),v.end());
    for (int i = 0; i < q; ++i) {
        char c; int a, b;
        tie(c, a, b) = v[i];
        if(c == 'R'){
            if(used1[a]) continue;
            used1[a] = 1;
            cnt1--;
            ans[b] += cnt2;
            rem -= cnt2;
        }else {
            if(used2[a]) continue;
            used2[a] = 1;
            cnt2--;
            ans[b] += cnt1;
            rem -= cnt1;
        }
    }
    ans[0] += rem;
    for (int i = 0; i < k; ++i) {
        printf("%lld\n", ans[i]);
    }
    return 0;
}
0