結果

問題 No.606 カラフルタイル
ユーザー bachoppibachoppi
提出日時 2020-08-18 14:05:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,266 bytes
コンパイル時間 1,127 ms
コンパイル使用メモリ 120,756 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-04-20 07:32:22
合計ジャッジ時間 3,792 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 3 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 3 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 6 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 AC 40 ms
6,968 KB
testcase_17 AC 174 ms
7,040 KB
testcase_18 AC 47 ms
6,940 KB
testcase_19 AC 47 ms
6,944 KB
testcase_20 AC 179 ms
6,940 KB
testcase_21 AC 50 ms
6,944 KB
testcase_22 AC 51 ms
6,940 KB
testcase_23 AC 72 ms
6,940 KB
testcase_24 AC 139 ms
6,944 KB
testcase_25 AC 181 ms
6,944 KB
testcase_26 AC 191 ms
6,940 KB
testcase_27 AC 175 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
  }
}
0