結果

問題 No.606 カラフルタイル
ユーザー FF256grhyFF256grhy
提出日時 2017-11-28 15:29:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 1,492 ms
コンパイル使用メモリ 167,004 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-05-05 14:54:25
合計ジャッジ時間 3,358 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 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 1 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 6 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 45 ms
5,888 KB
testcase_17 AC 80 ms
7,296 KB
testcase_18 AC 55 ms
6,656 KB
testcase_19 AC 54 ms
6,528 KB
testcase_20 AC 76 ms
8,192 KB
testcase_21 AC 56 ms
7,296 KB
testcase_22 AC 57 ms
7,424 KB
testcase_23 AC 65 ms
7,296 KB
testcase_24 AC 74 ms
7,168 KB
testcase_25 AC 70 ms
5,760 KB
testcase_26 AC 73 ms
7,424 KB
testcase_27 AC 72 ms
7,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define  dec(i, n) decID(i, 0, n)

// ---- ----

const int M = 100000;
LL n, k, q, a[M], b[M], c[M], f[2][M], ans[M];

int main() {
	cin >> n >> k >> q;
	inc(i, q) {
		string s;
		cin >> s >> b[i] >> c[i];
		a[i] = (s == "R" ? 0 : 1);
		b[i]--; c[i]--;
	}
	
	LL r[2] = { n, n };
	dec(i, q) {
		if(f[a[i]][b[i]] == 0) {
			ans[c[i]] += r[1 - a[i]];
			f[a[i]][b[i]] = 1;
			r[a[i]]--;
		}
	}
	ans[0] += r[0] * r[1];
	
	inc(i, k) { cout << ans[i] << "\n"; }
	
	return 0;
}
0