結果

問題 No.606 カラフルタイル
ユーザー waidottowaidotto
提出日時 2018-01-27 09:49:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 840 bytes
コンパイル時間 3,534 ms
コンパイル使用メモリ 154,240 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2023-08-28 09:48:43
合計ジャッジ時間 4,858 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 7 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 53 ms
8,660 KB
testcase_17 AC 83 ms
9,668 KB
testcase_18 AC 61 ms
9,404 KB
testcase_19 AC 60 ms
8,656 KB
testcase_20 AC 85 ms
9,220 KB
testcase_21 AC 62 ms
9,144 KB
testcase_22 AC 63 ms
8,476 KB
testcase_23 AC 74 ms
8,680 KB
testcase_24 AC 82 ms
10,144 KB
testcase_25 AC 83 ms
9,228 KB
testcase_26 AC 83 ms
9,948 KB
testcase_27 AC 83 ms
9,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void) {
	long long N, K, Q;
	cin >> N >> K >> Q;
	long long h = N;
	long long w = N;
	vector<string> A;
	vector<long long> B;
	vector<int> C;
	vector<bool> row_used(N, false);
	vector<bool> col_used(N, false);
	vector<long long> result(K, 0);
	result[0] = N * N;
	for(int i = 0; i < Q; ++i) {
		string a;
		long long b;
		int c;
		cin >> a >> b >> c;
		A.push_back(a);
		B.push_back(b - 1);
		C.push_back(c - 1);
	}
	for(int i = Q - 1; i >= 0; --i) {
		if(A[i] == "R") {
			if(!row_used[B[i]]) {
				row_used[B[i]] = true;
				result[C[i]] += w;
				result[0] -= w;
				--h;
			}
		} else {
			if(!col_used[B[i]]) {
				col_used[B[i]] = true;
				result[C[i]] += h;
				result[0] -= h;
				--w;
			}
		}
	}
	for(int i = 0; i < K; ++i) {
		cout << result[i] << '\n';
	}
	return 0;
}

0