結果

問題 No.606 カラフルタイル
ユーザー lapilapi
提出日時 2019-07-05 21:17:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 3,327 ms
コンパイル使用メモリ 105,100 KB
実行使用メモリ 6,372 KB
最終ジャッジ日時 2023-10-22 05:50:58
合計ジャッジ時間 4,370 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,700 KB
testcase_01 AC 2 ms
5,700 KB
testcase_02 AC 2 ms
5,700 KB
testcase_03 AC 2 ms
5,648 KB
testcase_04 AC 2 ms
5,700 KB
testcase_05 AC 2 ms
5,700 KB
testcase_06 AC 2 ms
5,700 KB
testcase_07 AC 2 ms
5,648 KB
testcase_08 AC 3 ms
5,700 KB
testcase_09 AC 2 ms
5,700 KB
testcase_10 AC 2 ms
5,700 KB
testcase_11 AC 2 ms
5,700 KB
testcase_12 AC 2 ms
5,704 KB
testcase_13 AC 4 ms
5,704 KB
testcase_14 AC 2 ms
5,700 KB
testcase_15 AC 2 ms
5,704 KB
testcase_16 AC 15 ms
5,704 KB
testcase_17 AC 139 ms
6,372 KB
testcase_18 AC 17 ms
5,704 KB
testcase_19 AC 16 ms
5,704 KB
testcase_20 AC 143 ms
6,372 KB
testcase_21 AC 18 ms
5,704 KB
testcase_22 AC 18 ms
5,704 KB
testcase_23 AC 35 ms
5,800 KB
testcase_24 AC 103 ms
6,232 KB
testcase_25 AC 140 ms
5,708 KB
testcase_26 AC 142 ms
6,372 KB
testcase_27 AC 141 ms
6,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include<iomanip>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60

char A[100009];
ll B[100009], C[100009];
bool row[100009], col[100009]; // true : もう塗られている

ll cnt[100009];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N, K, Q; cin >> N >> K >> Q;
	for (int i = 0; i < Q; i++) cin >> A[i] >> B[i] >> C[i];

	ll H = N, W = N;
	set<int> S;

	for (int i = Q - 1; i >= 0 && H > 0 && W > 0; i--) {
		if (A[i] == 'R') {
			if (!row[B[i]]) {
				row[B[i]] = true;
				H--;
				cnt[C[i]] += W;
			}
		}
		else { // A[i] == 'C'
			if (!col[B[i]]) {
				col[B[i]] = true;
				W--;
				cnt[C[i]] += H;
			}
		}
	}

	cnt[1] += H * W;
	for (int i = 1; i <= K; i++) cout << cnt[i] << endl;


	return 0;
}
0