結果

問題 No.606 カラフルタイル
ユーザー kotatsugamekotatsugame
提出日時 2020-03-04 08:09:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 65,088 KB
実行使用メモリ 5,504 KB
最終ジャッジ日時 2024-04-22 00:57:05
合計ジャッジ時間 3,342 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 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 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 5 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 41 ms
5,376 KB
testcase_17 AC 183 ms
5,504 KB
testcase_18 AC 52 ms
5,376 KB
testcase_19 AC 51 ms
5,376 KB
testcase_20 AC 192 ms
5,376 KB
testcase_21 AC 51 ms
5,376 KB
testcase_22 AC 51 ms
5,376 KB
testcase_23 AC 77 ms
5,376 KB
testcase_24 AC 145 ms
5,376 KB
testcase_25 AC 188 ms
5,376 KB
testcase_26 AC 186 ms
5,376 KB
testcase_27 AC 185 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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