結果

問題 No.606 カラフルタイル
ユーザー kotatsugame
提出日時 2020-03-04 08:09:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 63,616 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-10-13 23:30:17
合計ジャッジ時間 3,108 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N,K,Q;
char A[1<<17];
int B[1<<17],C[1<<17];
long cnt[1<<17];
bool vR[1<<17],vC[1<<17];
main()
{
	cin>>N>>K>>Q;
	for(int i=0;i<Q;i++)
	{
		cin>>A[i]>>B[i]>>C[i];
		B[i]--,C[i]--;
	}
	int rN=N,cN=N;
	cnt[0]=(long)N*N;
	for(int i=Q;i--;)
	{
		if(A[i]=='R')
		{
			if(vR[B[i]])continue;
			vR[B[i]]=true;
			cnt[0]-=cN;
			cnt[C[i]]+=cN;
			rN--;
		}
		else
		{
			if(vC[B[i]])continue;
			vC[B[i]]=true;
			cnt[0]-=rN;
			cnt[C[i]]+=rN;
			cN--;
		}
	}
	for(int i=0;i<K;i++)cout<<cnt[i]<<endl;
}
0