結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  ldsyb | 
| 提出日時 | 2017-12-15 19:32:42 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 195 ms / 2,000 ms | 
| コード長 | 723 bytes | 
| コンパイル時間 | 1,763 ms | 
| コンパイル使用メモリ | 167,608 KB | 
| 実行使用メモリ | 5,504 KB | 
| 最終ジャッジ日時 | 2024-12-14 15:58:57 | 
| 合計ジャッジ時間 | 5,238 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 25 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
	int64_t n, k, q;
	cin >> n >> k >> q;
	char a[q];
	int b[q], c[q];
	for (int i = 0; i < q; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	reverse(a, a + q);
	reverse(b, b + q);
	reverse(c, c + q);
	bool puni[n]{}, muni[n]{};
	int64_t ans[k]{}, row = n, column = n;
	for (int i = 0; i < q; i++) {
		if (a[i] == 'R') {
			if (puni[b[i] - 1]) {
				continue;
			}
			puni[b[i] - 1] = true;
			ans[c[i] - 1] += row;
			column--;
		} else {
			if (muni[b[i] - 1]) {
				continue;
			}
			muni[b[i] - 1] = true;
			ans[c[i] - 1] += column;
			row--;
		}
	}
	ans[0] += n * n - accumulate(ans, ans + k, int64_t(0));
	for (auto &i : ans) {
		cout << i << endl;
	}
	return 0;
}
            
            
            
        