結果

問題 No.945 YKC饅頭
ユーザー 東前頭十一枚目東前頭十一枚目
提出日時 2019-12-12 11:40:34
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 450 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 173,004 KB
実行使用メモリ 20,824 KB
最終ジャッジ日時 2023-09-07 02:49:06
合計ジャッジ時間 16,220 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,088 KB
testcase_01 AC 4 ms
8,156 KB
testcase_02 AC 5 ms
8,096 KB
testcase_03 AC 5 ms
8,148 KB
testcase_04 AC 4 ms
8,316 KB
testcase_05 AC 5 ms
8,232 KB
testcase_06 AC 5 ms
8,152 KB
testcase_07 AC 5 ms
8,124 KB
testcase_08 AC 5 ms
8,288 KB
testcase_09 AC 5 ms
8,292 KB
testcase_10 AC 5 ms
8,116 KB
testcase_11 AC 4 ms
8,240 KB
testcase_12 AC 5 ms
8,132 KB
testcase_13 AC 5 ms
8,148 KB
testcase_14 AC 5 ms
8,152 KB
testcase_15 AC 5 ms
8,116 KB
testcase_16 AC 5 ms
8,104 KB
testcase_17 AC 5 ms
8,164 KB
testcase_18 AC 5 ms
8,120 KB
testcase_19 AC 4 ms
8,276 KB
testcase_20 AC 5 ms
8,100 KB
testcase_21 AC 4 ms
8,300 KB
testcase_22 AC 5 ms
8,144 KB
testcase_23 AC 6 ms
8,160 KB
testcase_24 AC 5 ms
8,176 KB
testcase_25 AC 5 ms
8,360 KB
testcase_26 AC 5 ms
8,152 KB
testcase_27 AC 5 ms
8,084 KB
testcase_28 AC 5 ms
8,108 KB
testcase_29 AC 5 ms
8,088 KB
testcase_30 AC 4 ms
8,112 KB
testcase_31 AC 15 ms
8,772 KB
testcase_32 AC 7 ms
8,228 KB
testcase_33 AC 66 ms
11,224 KB
testcase_34 AC 189 ms
14,636 KB
testcase_35 AC 338 ms
18,748 KB
testcase_36 AC 251 ms
15,816 KB
testcase_37 AC 229 ms
15,316 KB
testcase_38 AC 204 ms
14,844 KB
testcase_39 AC 39 ms
9,984 KB
testcase_40 AC 30 ms
9,608 KB
testcase_41 AC 12 ms
8,592 KB
testcase_42 AC 306 ms
17,560 KB
testcase_43 AC 207 ms
14,460 KB
testcase_44 AC 243 ms
16,684 KB
testcase_45 AC 362 ms
18,372 KB
testcase_46 AC 6 ms
8,324 KB
testcase_47 AC 186 ms
14,820 KB
testcase_48 AC 36 ms
9,748 KB
testcase_49 AC 70 ms
11,296 KB
testcase_50 AC 389 ms
18,768 KB
testcase_51 AC 449 ms
20,688 KB
testcase_52 AC 435 ms
20,824 KB
testcase_53 AC 436 ms
20,684 KB
testcase_54 AC 435 ms
20,680 KB
testcase_55 AC 450 ms
20,712 KB
testcase_56 AC 5 ms
8,220 KB
testcase_57 AC 6 ms
8,224 KB
testcase_58 AC 166 ms
14,280 KB
testcase_59 AC 202 ms
15,268 KB
testcase_60 AC 71 ms
11,456 KB
testcase_61 AC 179 ms
14,552 KB
testcase_62 AC 170 ms
14,384 KB
testcase_63 AC 7 ms
8,284 KB
testcase_64 AC 79 ms
11,888 KB
testcase_65 AC 62 ms
11,060 KB
testcase_66 AC 58 ms
10,896 KB
testcase_67 AC 123 ms
13,292 KB
testcase_68 AC 74 ms
11,532 KB
testcase_69 AC 25 ms
9,300 KB
testcase_70 AC 31 ms
9,628 KB
testcase_71 AC 32 ms
9,764 KB
testcase_72 AC 96 ms
12,344 KB
testcase_73 AC 189 ms
14,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

vector<int> imos[200010]; 
int main() {
	int n, m; cin >> n >> m;
	int l[m], r[m], c[m];
	for(int i = 0; i < m; ++i) {
		char cc;
		cin >> l[i] >> r[i] >> cc;
		--l[i];
		imos[l[i]].push_back(i);
		imos[r[i]].push_back(i);
		const char v[] = {'Y', 'K', 'C'};
		for(int j = 0; j < 3; ++j) {
			if(v[j] == cc) c[i] = j;
		}
	}
	set<int> st;
	int cnt[3] = {};
	for(int i = 0; i < n; ++i) {
		for(int x : imos[i]) {
			auto itr = st.find(x);
			if(itr != st.end()) {
				st.erase(itr);
			} else {
				st.insert(x);
			}
		}
		if(st.empty()) continue;
		++cnt[c[*st.begin()]];
	}
	printf("%d %d %d\n", cnt[0], cnt[1], cnt[2]);
	return 0;
}
0