結果

問題 No.606 カラフルタイル
ユーザー hiroakiehiroakie
提出日時 2017-12-18 22:55:55
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 694 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 64,228 KB
実行使用メモリ 5,852 KB
最終ジャッジ日時 2023-08-22 06:06:26
合計ジャッジ時間 4,302 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 17 ms
4,944 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 3 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 24 ms
4,868 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 39 ms
4,380 KB
testcase_17 AC 192 ms
4,980 KB
testcase_18 AC 55 ms
4,376 KB
testcase_19 AC 52 ms
4,376 KB
testcase_20 AC 222 ms
5,692 KB
testcase_21 AC 78 ms
4,912 KB
testcase_22 AC 77 ms
4,916 KB
testcase_23 AC 94 ms
5,016 KB
testcase_24 AC 166 ms
5,408 KB
testcase_25 AC 197 ms
4,916 KB
testcase_26 AC 197 ms
5,852 KB
testcase_27 AC 199 ms
5,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int N = 100000;
int n, k, q;
pair<int, int> r[N], c[N];
long long int ct[N];
int main() {
	cin >> n >> k >> q;
	for (int i = 0; i < n; i++) { r[i] = make_pair(-i*2-2, 0); c[i] = make_pair(-i*2-1, 0); }
	for (int i = 0; i < q; i++) {
		char v1; int v2, v3; cin >> v1 >> v2 >> v3;
		if (v1 == 'R')r[v2 - 1] = make_pair(i, v3-1);
		else c[v2 - 1] = make_pair(i, v3-1);
	}
	sort(r, r + n);
	sort(c, c + n);
	for (int i = 0; i < n; i++) {
		ct[r[i].second]+= lower_bound(c, c + n, r[i]) - c;
		ct[c[i].second] += lower_bound(r, r + n, c[i]) - r;
	}
	for (int i = 0; i < k; i++)cout << ct[i] << endl;
	return 0;
}
0