結果

問題 No.945 YKC饅頭
ユーザー polylogKpolylogK
提出日時 2019-12-12 21:57:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,001 bytes
コンパイル時間 1,764 ms
コンパイル使用メモリ 173,508 KB
実行使用メモリ 14,272 KB
最終ジャッジ日時 2023-09-08 00:41:47
合計ジャッジ時間 10,834 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 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,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 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,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 8 ms
4,584 KB
testcase_32 AC 5 ms
5,836 KB
testcase_33 AC 36 ms
8,212 KB
testcase_34 AC 85 ms
8,700 KB
testcase_35 AC 161 ms
12,832 KB
testcase_36 AC 98 ms
7,040 KB
testcase_37 AC 92 ms
7,152 KB
testcase_38 AC 88 ms
7,156 KB
testcase_39 AC 22 ms
6,580 KB
testcase_40 AC 20 ms
7,516 KB
testcase_41 AC 7 ms
5,772 KB
testcase_42 AC 122 ms
10,096 KB
testcase_43 AC 82 ms
6,620 KB
testcase_44 AC 105 ms
10,708 KB
testcase_45 AC 138 ms
9,392 KB
testcase_46 AC 4 ms
5,044 KB
testcase_47 AC 86 ms
8,964 KB
testcase_48 AC 20 ms
4,440 KB
testcase_49 AC 39 ms
7,408 KB
testcase_50 AC 153 ms
10,308 KB
testcase_51 AC 191 ms
14,100 KB
testcase_52 AC 189 ms
14,064 KB
testcase_53 AC 171 ms
14,104 KB
testcase_54 AC 168 ms
14,104 KB
testcase_55 AC 190 ms
14,272 KB
testcase_56 AC 6 ms
7,776 KB
testcase_57 AC 4 ms
7,668 KB
testcase_58 AC 119 ms
12,112 KB
testcase_59 AC 144 ms
12,852 KB
testcase_60 AC 53 ms
9,812 KB
testcase_61 AC 126 ms
12,304 KB
testcase_62 AC 123 ms
12,152 KB
testcase_63 AC 5 ms
7,780 KB
testcase_64 AC 55 ms
9,840 KB
testcase_65 AC 45 ms
9,588 KB
testcase_66 AC 40 ms
9,484 KB
testcase_67 AC 92 ms
10,896 KB
testcase_68 AC 56 ms
9,864 KB
testcase_69 AC 20 ms
8,668 KB
testcase_70 AC 25 ms
8,484 KB
testcase_71 AC 23 ms
8,664 KB
testcase_72 AC 72 ms
10,440 KB
testcase_73 AC 139 ms
12,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, m; scanf("%d%d", &n, &m);
	std::vector<int> L(m), R(m);
	std::vector<char> T(m);
	std::vector<std::vector<int>> vec(n);
	for(int i = 0; i < m; i++) {
		cin >> L[i] >> R[i] >> T[i];
		L[i]--;
		
		vec[L[i]].push_back(i);
	}
	
	int Y = 0, K = 0, C = 0;
	std::priority_queue<int, std::vector<int>, std::greater<int>> qu;
	for(int i = 0; i < n; i++) {
		while(!qu.empty() and R[qu.top()] <= i) qu.pop();
		for(auto id: vec[i]) qu.push(id);
		if(qu.empty()) continue;
		
		Y += (T[qu.top()] == 'Y');
		K += (T[qu.top()] == 'K');
		C += (T[qu.top()] == 'C');
	}
	
	printf("%d %d %d\n", Y, K, C);
	return 0;
}
0