結果
| 問題 | 
                            No.945 YKC饅頭
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-12-08 10:41:25 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 145 ms / 2,000 ms | 
| コード長 | 479 bytes | 
| コンパイル時間 | 678 ms | 
| コンパイル使用メモリ | 72,064 KB | 
| 実行使用メモリ | 12,928 KB | 
| 最終ジャッジ日時 | 2024-12-29 20:34:13 | 
| 合計ジャッジ時間 | 6,539 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 74 | 
ソースコード
#include<iostream>
#include<set>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n, m, ans[3] = {};
	cin >> n >> m;
	set<int> s;
	while(n > 0)    s.insert(n--);
	while(m--){
		int l, r;
		char c;
		cin >> l >> r >> c;
		int ind = c=='Y' ? 0 : c=='K' ? 1 : 2;
		for(auto it = s.lower_bound(l); it != s.end() && *it <= r;){
			ans[ind]++;
			it = s.erase(it);
		}
	}
	for(int i = 0; i < 3; i++)    cout << ans[i] << " \n"[i==2];
	return 0;
}