結果

問題 No.606 カラフルタイル
ユーザー furafura
提出日時 2020-07-11 23:37:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 2,329 ms
コンパイル使用メモリ 202,820 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-04-21 18:11:52
合計ジャッジ時間 4,818 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 21 ms
5,376 KB
testcase_17 AC 70 ms
9,600 KB
testcase_18 AC 58 ms
9,088 KB
testcase_19 AC 54 ms
8,320 KB
testcase_20 AC 74 ms
8,704 KB
testcase_21 AC 59 ms
7,936 KB
testcase_22 AC 60 ms
7,936 KB
testcase_23 AC 58 ms
7,168 KB
testcase_24 AC 65 ms
7,680 KB
testcase_25 AC 32 ms
5,376 KB
testcase_26 AC 71 ms
9,728 KB
testcase_27 AC 71 ms
9,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n,k,q; scanf("%d%d%d",&n,&k,&q);
	vector<char> type(q);
	vector<int> pos(q),color(q);
	rep(i,q) scanf(" %c%d%d",&type[i],&pos[i],&color[i]), pos[i]--, color[i]--;

	vector<lint> ans(k);
	int rcnt=0,ccnt=0;
	set<int> R_used,C_used;
	for(int i=q-1;i>=0;i--){
		if(type[i]=='R'){
			if(R_used.count(pos[i])>0) continue;
			ans[color[i]]+=n-ccnt;
			rcnt++;
			R_used.emplace(pos[i]);
		}
		else{
			if(C_used.count(pos[i])>0) continue;
			ans[color[i]]+=n-rcnt;
			ccnt++;
			C_used.emplace(pos[i]);
		}
	}
	ans[0]+=1LL*n*n-accumulate(ans.begin(),ans.end(),0LL);

	rep(i,k) printf("%lld\n",ans[i]);

	return 0;
}
0