結果

問題 No.606 カラフルタイル
ユーザー Makoto7899Makoto7899
提出日時 2019-11-13 20:19:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 980 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 56,624 KB
実行使用メモリ 10,756 KB
最終ジャッジ日時 2023-10-21 19:47:24
合計ジャッジ時間 13,165 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>

using namespace std;

int main(void) {
	// 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 int color[100000] = { 0 };
	bool rowFlag[100000] = { false };
	bool colFlag[100000] = { false };
	unsigned long long int baseColor = N * N;
	for (int i = Q - 1; i >= 0; i--) {
		int point = N;
		if (a[i] == 'R') {
			if (rowFlag[b[i]-1] == true) {
				point = 0;
			}
			else {
				for (int j = 0; j < N; j++) {
					if (colFlag[j] == true) point--;
				}
			}
			rowFlag[b[i]-1] = true;
		}
		else {
			if (colFlag[b[i]-1] == true) {
				point = 0;
			}
			else {
				for (int j = 0; j < N; j++) {
					if (rowFlag[j] == true) point--;
				}
			}
			colFlag[b[i]-1] = true;
		}
		
		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