結果

問題 No.606 カラフルタイル
ユーザー waidotto
提出日時 2018-01-27 09:49:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 840 bytes
コンパイル時間 1,840 ms
コンパイル使用メモリ 170,516 KB
実行使用メモリ 11,004 KB
最終ジャッジ日時 2024-12-29 06:36:14
合計ジャッジ時間 4,748 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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