結果

問題 No.945 YKC饅頭
ユーザー yakki
提出日時 2019-12-08 02:24:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 1,156 bytes
コンパイル時間 1,560 ms
コンパイル使用メモリ 91,680 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-12-27 15:08:53
合計ジャッジ時間 9,009 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 74
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int N,M; cin >> N >> M;
    int y = 0,k = 0,c = 0;
    set<int> st;
    rep(i,N) st.insert(i);
    rep(i,M){
        int l,r; cin >> l >> r;
        l--; r--;
        char t; cin >> t;
        auto a = st.lower_bound(l);
        auto b = st.upper_bound(r);
        int s = st.size();
        st.erase(a,b);
        int d = st.size();
        int update = s-d;
        if(t == 'Y') y += update;
        if(t == 'K') k += update;
        if(t == 'C') c += update;
    }
    cout << y << " " << k << " " << c << endl;
}
0