結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-11-13 21:23:07 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 844 bytes | 
| コンパイル時間 | 432 ms | 
| コンパイル使用メモリ | 54,744 KB | 
| 実行使用メモリ | 5,504 KB | 
| 最終ジャッジ日時 | 2024-09-21 21:14:58 | 
| 合計ジャッジ時間 | 3,170 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 14 WA * 11 | 
ソースコード
#include <iostream>
using namespace std;
int main() {
	// Your code here!
	int N, K, Q;
	char a[100000];
	int b[100000], c[100000];
	cin >> N >> K >> Q;
	for (int i = 0; i < Q; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	long long color[100000] = { 0 };
	int rowCnt = 0;
	int colCnt = 0;
	bool rowSet[100000] = { false };
	bool colSet[100000] = { false };
	long long baseColor = N * N;
	for (int i = Q - 1; i >= 0; i--) {
		int point = 0;
		if (a[i] == 'R' && rowSet[b[i] - 1] == false) {
			point = N - colCnt;
			rowSet[b[i]-1] = true;
			rowCnt++;
		}
		else if (a[i] == 'C' && colSet[b[i] - 1] == false) {
			point = N - rowCnt;
			colSet[b[i]-1] = true;
			colCnt++;
		}
		color[c[i]-1] += point;
		baseColor -= point;
	}
	cout << color[0] + baseColor << endl;
	for (int i = 1; i < K; i++) {
		cout << color[i] << endl;
	}
	return 0;
}
            
            
            
        