結果

問題 No.606 カラフルタイル
ユーザー milanis48663220milanis48663220
提出日時 2020-06-30 22:05:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 1,010 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 88,764 KB
実行使用メモリ 14,684 KB
最終ジャッジ日時 2023-10-11 13:12:28
合計ジャッジ時間 4,431 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 59 ms
12,772 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 5 ms
4,384 KB
testcase_12 AC 1 ms
4,356 KB
testcase_13 AC 3 ms
4,348 KB
testcase_14 AC 58 ms
13,048 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 16 ms
4,348 KB
testcase_17 AC 182 ms
9,792 KB
testcase_18 AC 51 ms
8,944 KB
testcase_19 AC 44 ms
8,376 KB
testcase_20 AC 267 ms
14,416 KB
testcase_21 AC 128 ms
13,696 KB
testcase_22 AC 128 ms
13,636 KB
testcase_23 AC 141 ms
13,788 KB
testcase_24 AC 213 ms
14,180 KB
testcase_25 AC 206 ms
13,700 KB
testcase_26 AC 222 ms
14,472 KB
testcase_27 AC 213 ms
14,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int N, K, Q;
ll cnt[100000];
char A[100000];
int B[100000], C[100000];
set<int> r, c;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> K >> Q;
    for(int i = 0; i < N; i++){
        c.insert(i); r.insert(i);
    }
    for(int i = 0; i < Q; i++){
        cin >> A[i] >> B[i] >> C[i];
        B[i]--; C[i]--;
    }
    for(int i = Q-1; i >= 0; i--){
        if(A[i] == 'R'){
            if(r.count(B[i]) == 0) continue;
            cnt[C[i]] += c.size();
            r.erase(B[i]);
        }else{
            if(c.count(B[i]) == 0) continue;
            cnt[C[i]] += r.size();
            c.erase(B[i]);
        }
    }
    ll total = (ll)N*(ll)N;
    for(int i = 0; i < K; i++) total -= cnt[i];
    cnt[0] += total;
    for(int i = 0; i < K; i++) cout << cnt[i] << endl;
}
0