結果

問題 No.945 YKC饅頭
ユーザー SSRSSSRS
提出日時 2020-11-27 16:27:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 830 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 85,632 KB
実行使用メモリ 21,272 KB
最終ジャッジ日時 2023-10-01 04:12:35
合計ジャッジ時間 13,254 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 12 ms
4,696 KB
testcase_32 AC 5 ms
6,140 KB
testcase_33 AC 62 ms
9,520 KB
testcase_34 AC 184 ms
12,276 KB
testcase_35 AC 306 ms
18,644 KB
testcase_36 AC 251 ms
12,396 KB
testcase_37 AC 219 ms
11,912 KB
testcase_38 AC 204 ms
11,712 KB
testcase_39 AC 37 ms
7,024 KB
testcase_40 AC 30 ms
8,012 KB
testcase_41 AC 11 ms
5,920 KB
testcase_42 AC 291 ms
15,840 KB
testcase_43 AC 208 ms
10,916 KB
testcase_44 AC 238 ms
15,168 KB
testcase_45 AC 342 ms
15,960 KB
testcase_46 AC 5 ms
4,628 KB
testcase_47 AC 180 ms
12,568 KB
testcase_48 AC 35 ms
5,180 KB
testcase_49 AC 67 ms
8,536 KB
testcase_50 AC 364 ms
16,992 KB
testcase_51 AC 403 ms
21,076 KB
testcase_52 AC 401 ms
21,272 KB
testcase_53 AC 406 ms
21,152 KB
testcase_54 AC 391 ms
21,260 KB
testcase_55 AC 388 ms
21,084 KB
testcase_56 AC 5 ms
7,724 KB
testcase_57 AC 5 ms
7,728 KB
testcase_58 AC 141 ms
14,056 KB
testcase_59 AC 174 ms
15,068 KB
testcase_60 AC 57 ms
11,116 KB
testcase_61 AC 143 ms
14,304 KB
testcase_62 AC 141 ms
14,044 KB
testcase_63 AC 6 ms
7,708 KB
testcase_64 AC 73 ms
11,152 KB
testcase_65 AC 50 ms
10,724 KB
testcase_66 AC 46 ms
10,428 KB
testcase_67 AC 105 ms
12,696 KB
testcase_68 AC 57 ms
11,180 KB
testcase_69 AC 20 ms
9,060 KB
testcase_70 AC 26 ms
9,264 KB
testcase_71 AC 27 ms
9,420 KB
testcase_72 AC 83 ms
12,208 KB
testcase_73 AC 164 ms
14,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main(){
	int N,M;
	cin >> N >> M;
	vector<int> L(M), R(M);
	vector<char> T(M);
	for (int i = 0; i < M; i++){
		cin >> L[i] >> R[i] >> T[i];
		L[i]--;
	}
	vector<vector<pair<int, char>>> d(N + 1);
	for (int i = 0; i < M; i++){
		d[L[i]].push_back(make_pair(i, T[i]));
		d[R[i]].push_back(make_pair(i, T[i]));
	}
	int Y = 0, K = 0, C = 0;
	set<pair<int, int>> st;
	for (int i = 0; i < N; i++){
		int cnt = d[i].size();
		for (int j = 0; j < cnt; j++){
			if (!st.count(d[i][j])){
				st.insert(d[i][j]);
			} else {
				st.erase(d[i][j]);
			}
		}
		if (!st.empty()){
			char ch = (*st.begin()).second;
			if (ch == 'Y'){
				Y++;
			}
			if (ch == 'K'){
				K++;
			}
			if (ch == 'C'){
				C++;
			}
		}
	}
	cout << Y << ' ' << K << ' ' << C << endl;
}
0