結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-11-13 21:36:22 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 804 bytes | 
| コンパイル時間 | 728 ms | 
| コンパイル使用メモリ | 68,456 KB | 
| 最終ジャッジ日時 | 2025-01-08 03:58:24 | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 16 WA * 9 | 
ソースコード
#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];
	}
	int color[100000] = { 0 };
	int rowCnt = 0;
	int colCnt = 0;
	bool rowSet[100000] = { false };
	bool colSet[100000] = { false };
	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;
	}
	cout << color[0] + (N - rowCnt) * (N - colCnt) << endl;
	for (int i = 1; i < K; i++) {
		cout << color[i] << endl;
	}
	return 0;
}
            
            
            
        