結果
問題 | No.606 カラフルタイル |
ユーザー |
|
提出日時 | 2017-12-06 00:58:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 150 ms / 2,000 ms |
コード長 | 976 bytes |
コンパイル時間 | 1,463 ms |
コンパイル使用メモリ | 167,664 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 19:16:53 |
合計ジャッジ時間 | 3,648 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;char a[100005];int b[100005], c[100005];ll color[100005];bool ur[100005], uc[100005];int main() {cin.tie(0);ios::sync_with_stdio(false);int N, K, Q;cin >> N >> K >> Q;for (int i = 0; i < Q; i++) {cin >> a[i] >> b[i] >> c[i];b[i]--;c[i]--;}int cr = 0, cc = 0;color[0] = (ll)N * N;for (int i = Q - 1; i >= 0; i--) {if (a[i] == 'R') {if (ur[b[i]]) continue;ur[b[i]] = true;color[c[i]] += N - cc;color[0] -= N - cc;cr++;if (cr == N) break;} else {if (uc[b[i]]) continue;uc[b[i]] = true;color[c[i]] += N - cr;color[0] -= N - cr;cc++;if (cc == N) break;}}for (int i = 0; i < K; i++) {cout << color[i] << endl;}return 0;}