結果
| 問題 | 
                            No.945 YKC饅頭
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-08-07 05:05:35 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 108 ms / 2,000 ms | 
| コード長 | 648 bytes | 
| コンパイル時間 | 1,921 ms | 
| コンパイル使用メモリ | 174,468 KB | 
| 実行使用メモリ | 14,208 KB | 
| 最終ジャッジ日時 | 2024-11-07 08:34:13 | 
| 合計ジャッジ時間 | 8,333 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 74 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, l, r;
    char c;
    cin >> n >> m;
    vector<int> tmp(n + 1), ans(n);
    iota(tmp.begin(), tmp.end(), 1);
    set<int> S{tmp.begin(), tmp.end()};
    auto f = [&](char c){
        if(c == 'Y') return 0;
        return c == 'K' ? 1 : 2;
    };
    while(m--){
        cin >> l >> r >> c;
        auto it = S.lower_bound(l);
        int cn = f(c);
        while(*it <= r){
            ans[cn]++;
            S.erase(it++);
        }
    }
    cout << ans[0] << ' ' << ans[1] << ' ' << ans[2] << '\n';
}