結果
| 問題 |
No.606 カラフルタイル
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-02 17:52:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 188 ms / 2,000 ms |
| コード長 | 836 bytes |
| コンパイル時間 | 730 ms |
| コンパイル使用メモリ | 72,056 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-23 12:26:59 |
| 合計ジャッジ時間 | 3,855 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
typedef long long ll;
int main(){
int n, k, q;
cin >> n >> k >> q;
int row = n, col = n;
char a[q];
int b[q], c[q];
for(int i = 0; i < q; i++) cin >> a[i] >> b[i] >> c[i];
vector<ll> ans(k, 0);
vector<bool> rowb(n, 0), colb(n, 0);
for(int i = q-1; i >= 0; i--){
if(a[i] == 'R'){
if(rowb[b[i]-1]) continue;
rowb[b[i]-1] = true;
ans[c[i]-1] += col;
row--;
}else if(a[i] == 'C'){
if(colb[b[i]-1]) continue;
colb[b[i]-1] = true;
ans[c[i]-1] += row;
col--;
}
}
ans[0] += (ll)n*n - accumulate(ans.begin(), ans.end(), 0ll);
for(int i = 0; i < k; i++) cout << ans[i] << endl;
return 0;
}