結果
問題 | No.606 カラフルタイル |
ユーザー |
|
提出日時 | 2023-02-04 19:11:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 813 bytes |
コンパイル時間 | 1,703 ms |
コンパイル使用メモリ | 179,948 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-03 15:49:33 |
合計ジャッジ時間 | 3,599 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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);}reverse(query.begin(), query.end());for(int i = 0; i < q; i++){tie(p, x, c) = query[i];x += p == 1 ? n : 0;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';}