結果
| 問題 |
No.606 カラフルタイル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-13 21:21:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 838 bytes |
| コンパイル時間 | 2,683 ms |
| コンパイル使用メモリ | 54,696 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-21 21:14:54 |
| 合計ジャッジ時間 | 3,503 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 14 WA * 11 |
ソースコード
#include <iostream>
using namespace std;
int main() {
// 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];
}
int color[100000] = { 0 };
int rowCnt = 0;
int colCnt = 0;
bool rowSet[100000] = { false };
bool colSet[100000] = { false };
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;
}