結果

問題 No.606 カラフルタイル
ユーザー Makoto7899Makoto7899
提出日時 2019-11-13 22:00:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 877 bytes
コンパイル時間 914 ms
コンパイル使用メモリ 65,180 KB
実行使用メモリ 5,500 KB
最終ジャッジ日時 2023-10-21 19:52:31
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,632 KB
testcase_01 AC 2 ms
4,632 KB
testcase_02 AC 2 ms
4,632 KB
testcase_03 AC 2 ms
4,632 KB
testcase_04 AC 2 ms
4,632 KB
testcase_05 AC 2 ms
4,632 KB
testcase_06 AC 2 ms
4,632 KB
testcase_07 AC 2 ms
4,632 KB
testcase_08 AC 2 ms
4,632 KB
testcase_09 AC 2 ms
4,632 KB
testcase_10 AC 2 ms
4,632 KB
testcase_11 AC 3 ms
4,632 KB
testcase_12 AC 2 ms
4,632 KB
testcase_13 AC 6 ms
4,720 KB
testcase_14 AC 2 ms
4,632 KB
testcase_15 AC 3 ms
4,644 KB
testcase_16 AC 40 ms
5,500 KB
testcase_17 AC 181 ms
5,500 KB
testcase_18 AC 51 ms
5,500 KB
testcase_19 AC 48 ms
5,500 KB
testcase_20 AC 180 ms
5,500 KB
testcase_21 AC 52 ms
5,500 KB
testcase_22 AC 53 ms
5,500 KB
testcase_23 AC 72 ms
5,500 KB
testcase_24 AC 137 ms
5,500 KB
testcase_25 AC 176 ms
5,500 KB
testcase_26 AC 178 ms
5,500 KB
testcase_27 AC 176 ms
5,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
	// Your code here!
	unsigned long long 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];
	}

	unsigned long long color[100000] = { 0 };
	int rowCnt = 0;
	int colCnt = 0;
	bool rowSet[100000] = { false };
	bool colSet[100000] = { false };
	unsigned 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