結果

問題 No.606 カラフルタイル
ユーザー Makoto7899Makoto7899
提出日時 2019-11-13 21:21:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 838 bytes
コンパイル時間 1,126 ms
コンパイル使用メモリ 56,220 KB
実行使用メモリ 5,152 KB
最終ジャッジ日時 2023-10-21 19:50:26
合計ジャッジ時間 3,362 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,144 KB
testcase_01 AC 3 ms
5,144 KB
testcase_02 WA -
testcase_03 AC 3 ms
5,144 KB
testcase_04 AC 2 ms
5,144 KB
testcase_05 AC 3 ms
5,144 KB
testcase_06 AC 3 ms
5,144 KB
testcase_07 AC 2 ms
5,144 KB
testcase_08 AC 3 ms
5,144 KB
testcase_09 AC 2 ms
5,144 KB
testcase_10 AC 3 ms
5,144 KB
testcase_11 AC 3 ms
5,144 KB
testcase_12 AC 2 ms
5,144 KB
testcase_13 AC 7 ms
5,144 KB
testcase_14 WA -
testcase_15 AC 3 ms
5,144 KB
testcase_16 AC 44 ms
5,144 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 51 ms
5,144 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 };
	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;
}
0