結果
問題 | No.606 カラフルタイル |
ユーザー |
|
提出日時 | 2017-12-06 00:05:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 196 ms / 2,000 ms |
コード長 | 870 bytes |
コンパイル時間 | 661 ms |
コンパイル使用メモリ | 76,244 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 18:13:02 |
合計ジャッジ時間 | 3,393 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream>#include <algorithm>#include <vector>using namespace std;int main() {int n, k, q;cin >> n >> k >> q;vector<int> a(q), b(q), c(q);for (int i = 0; i < q; i++) {char tmp;cin >> tmp >> b[i] >> c[i];a[i] = tmp == 'C';b[i]--;c[i]--;}vector<bool> used_row(n);vector<bool> used_col(n);long long left_row = n;long long left_col = n;vector<long long> cnt(k);for (int i = q - 1; i >= 0; i--) {if (a[i]) {// colif (used_col[ b[i] ]) continue;used_col[ b[i] ] = true;cnt[ c[i] ] += left_row;left_col--;} else {// rowif (used_row[ b[i] ]) continue;used_row[ b[i] ] = true;cnt[ c[i] ] += left_col;left_row--;}}cnt[0] += left_row * left_col;for (int i = 0; i < k; i++) {cout << cnt[i] << endl;}}