結果

問題 No.945 YKC饅頭
ユーザー chocopuuchocopuu
提出日時 2019-12-08 00:17:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 379 ms / 2,000 ms
コード長 1,168 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 184,528 KB
実行使用メモリ 26,044 KB
最終ジャッジ日時 2023-08-27 07:14:34
合計ジャッジ時間 10,774 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 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,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 3 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,384 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 2 ms
4,376 KB
testcase_30 AC 1 ms
4,384 KB
testcase_31 AC 12 ms
5,064 KB
testcase_32 AC 5 ms
7,024 KB
testcase_33 AC 54 ms
10,880 KB
testcase_34 AC 160 ms
14,864 KB
testcase_35 AC 272 ms
22,536 KB
testcase_36 AC 221 ms
16,028 KB
testcase_37 AC 193 ms
15,076 KB
testcase_38 AC 173 ms
14,348 KB
testcase_39 AC 33 ms
7,816 KB
testcase_40 AC 27 ms
9,268 KB
testcase_41 AC 10 ms
6,836 KB
testcase_42 AC 262 ms
19,508 KB
testcase_43 AC 177 ms
13,896 KB
testcase_44 AC 207 ms
18,268 KB
testcase_45 AC 299 ms
20,220 KB
testcase_46 AC 4 ms
5,408 KB
testcase_47 AC 153 ms
14,920 KB
testcase_48 AC 31 ms
5,788 KB
testcase_49 AC 52 ms
9,780 KB
testcase_50 AC 312 ms
21,360 KB
testcase_51 AC 340 ms
26,044 KB
testcase_52 AC 350 ms
25,988 KB
testcase_53 AC 379 ms
25,972 KB
testcase_54 AC 340 ms
25,932 KB
testcase_55 AC 345 ms
25,996 KB
testcase_56 AC 6 ms
9,300 KB
testcase_57 AC 6 ms
9,564 KB
testcase_58 AC 138 ms
16,300 KB
testcase_59 AC 172 ms
17,784 KB
testcase_60 AC 55 ms
12,536 KB
testcase_61 AC 139 ms
16,804 KB
testcase_62 AC 132 ms
16,368 KB
testcase_63 AC 6 ms
9,412 KB
testcase_64 AC 62 ms
12,728 KB
testcase_65 AC 47 ms
11,940 KB
testcase_66 AC 45 ms
11,952 KB
testcase_67 AC 98 ms
14,580 KB
testcase_68 AC 60 ms
12,436 KB
testcase_69 AC 20 ms
10,588 KB
testcase_70 AC 25 ms
10,588 KB
testcase_71 AC 24 ms
10,880 KB
testcase_72 AC 74 ms
13,520 KB
testcase_73 AC 151 ms
17,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;



signed main(){
	int N,M;
	cin>>N>>M;
	vector<pair<int,int>>q[N+2];
	map<char,int>mp;
	mp['Y']=0;
	mp['K']=1;
	mp['C']=2;
	REP(i,M){
		int l,r;
		char c;
		cin>>l>>r>>c;
		q[l-1].push_back({i+1,mp[c]});
		q[r].push_back({-i-1,mp[c]});
	}
	set<pair<int,int>>st;
	vector<int>ans(N,-1);
	REP(i,N){
		for(auto e:q[i]){
			int t = e.first;
			int c = e.second;
			if(t > 0){
				st.insert({t,c});
			}else{
				st.erase({-t,c});
			}
		}
		if(st.begin()==st.end())continue;
		ans[i]=st.begin()->second;
	}
	vector<int>cnt(3,0);
	REP(i,N)if(ans[i]!=-1)cnt[ans[i]]++;
	REP(i,cnt.size())cout << cnt[i] << " \n"[i+1 == cnt.size()];
} 
0