結果
問題 |
No.606 カラフルタイル
|
ユーザー |
|
提出日時 | 2023-02-04 19:13:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 1,462 ms |
コンパイル使用メモリ | 177,300 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-03 15:51:13 |
合計ジャッジ時間 | 2,846 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, k, q, x, c, p; cin >> n >> k >> q; int X = n, Y = n; vector<tuple<int,int,int>> query(q); vector<bool> used(n + n); vector<ll> ans(k); char t; for(int i = 0; i < q; i++){ cin >> t >> x >> c; query[i] = make_tuple(t == 'C', x - 1, c - 1); } for(int i = q - 1; i >= 0; i--){ tie(p, x, c) = query[i]; if(p)x += n; if(used[x]) continue; used[x] = true; if(p){ ans[c] += Y; X--; }else{ ans[c] += X; Y--; } } ans[0] += (ll)X * Y; for(auto &&v:ans)cout << v << '\n'; }