結果
問題 |
No.606 カラフルタイル
|
ユーザー |
![]() |
提出日時 | 2020-08-18 14:05:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 401 ms / 2,000 ms |
コード長 | 1,266 bytes |
コンパイル時間 | 1,144 ms |
コンパイル使用メモリ | 116,404 KB |
最終ジャッジ日時 | 2025-01-13 03:04:41 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<iomanip> #include<math.h> #include<complex> #include<queue> #include<deque> #include<stack> #include<map> #include<set> #include<bitset> #include<functional> #include<assert.h> #include<numeric> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ ll n, h, q; cin >> n >> h >> q; pair<char, pair<ll, ll>>P[q]; rep(i, q){ char c; ll a, b; cin >> c >> a >> b; a--; b--; P[i] = {c, {a, b}}; } ll iro[101010] = {}; ll tate=0, yoko=0; bool tatecheck[101010]={}, yokocheck[101010] = {}; for(int i=q-1; i>=0; i--){ if(P[i].first=='C' && !tatecheck[P[i].second.first]){ tate++; iro[P[i].second.second]+=(ll)(n-yoko); tatecheck[P[i].second.first]=true; } else if(P[i].first=='R' && !yokocheck[P[i].second.first]){ yoko++; iro[P[i].second.second]+=(ll)(n-tate); yokocheck[P[i].second.first]=true; } } ll sum = 0; for(int i=1; i<h; i++){ sum+=iro[i]; } //cout << sum << endl; rep(i, h){ if(i==0) cout << (ll)n*n-sum << endl; else cout << iro[i] << endl; } }