結果
問題 | No.606 カラフルタイル |
ユーザー | kuwa |
提出日時 | 2017-12-10 17:51:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 884 bytes |
コンパイル時間 | 559 ms |
コンパイル使用メモリ | 66,484 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-30 11:19:16 |
合計ジャッジ時間 | 2,656 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; using ll = long long; int N, K, Q; char a[100000]; int b[100000], c[100000]; char vr[100000], vc[100000]; int main() { cin.tie(0); ios::sync_with_stdio(false); cin >> N >> K >> Q; for (int j = 0; j < Q; ++j) { cin >> a[j] >> b[j] >> c[j]; --b[j]; --c[j]; } ll ans[100000], s = 0; fill(ans, ans+K, 0); int ir = N, ic = N; for (int j = Q-1; j >= 0; --j) { if (a[j] == 'R' && !vr[b[j]]) { s += ir; ans[c[j]] += ir; vr[b[j]] = true; --ic; } if (a[j] == 'C' && !vc[b[j]]) { s += ic; ans[c[j]] += ic; vc[b[j]] = true; --ir; } } ans[0] += (ll)N*N - s; for (int j = 0; j < K; ++j) { cout << ans[j] << endl; } return 0; }