結果

問題 No.945 YKC饅頭
ユーザー tko919tko919
提出日時 2019-12-08 01:07:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 1,160 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 169,048 KB
実行使用メモリ 14,648 KB
最終ジャッジ日時 2023-08-27 14:44:43
合計ジャッジ時間 6,923 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,580 KB
testcase_01 AC 4 ms
9,628 KB
testcase_02 AC 4 ms
9,592 KB
testcase_03 AC 4 ms
9,652 KB
testcase_04 AC 4 ms
9,592 KB
testcase_05 AC 4 ms
9,552 KB
testcase_06 AC 4 ms
9,708 KB
testcase_07 AC 4 ms
9,672 KB
testcase_08 AC 4 ms
9,632 KB
testcase_09 AC 4 ms
9,612 KB
testcase_10 AC 4 ms
9,560 KB
testcase_11 AC 4 ms
9,888 KB
testcase_12 AC 4 ms
9,640 KB
testcase_13 AC 5 ms
9,648 KB
testcase_14 AC 5 ms
9,652 KB
testcase_15 AC 4 ms
9,644 KB
testcase_16 AC 4 ms
9,604 KB
testcase_17 AC 5 ms
9,644 KB
testcase_18 AC 4 ms
9,644 KB
testcase_19 AC 4 ms
9,628 KB
testcase_20 AC 4 ms
9,592 KB
testcase_21 AC 4 ms
9,884 KB
testcase_22 AC 4 ms
9,652 KB
testcase_23 AC 4 ms
9,656 KB
testcase_24 AC 5 ms
9,768 KB
testcase_25 AC 4 ms
9,660 KB
testcase_26 AC 4 ms
9,652 KB
testcase_27 AC 4 ms
9,700 KB
testcase_28 AC 4 ms
9,752 KB
testcase_29 AC 4 ms
9,632 KB
testcase_30 AC 4 ms
9,624 KB
testcase_31 AC 8 ms
10,000 KB
testcase_32 AC 5 ms
10,224 KB
testcase_33 AC 23 ms
11,232 KB
testcase_34 AC 48 ms
11,984 KB
testcase_35 AC 100 ms
14,004 KB
testcase_36 AC 58 ms
11,424 KB
testcase_37 AC 54 ms
11,808 KB
testcase_38 AC 51 ms
11,400 KB
testcase_39 AC 17 ms
10,716 KB
testcase_40 AC 14 ms
10,820 KB
testcase_41 AC 7 ms
10,284 KB
testcase_42 AC 73 ms
13,076 KB
testcase_43 AC 49 ms
11,332 KB
testcase_44 AC 64 ms
12,912 KB
testcase_45 AC 76 ms
12,724 KB
testcase_46 AC 5 ms
9,988 KB
testcase_47 AC 49 ms
12,032 KB
testcase_48 AC 15 ms
10,152 KB
testcase_49 AC 27 ms
11,220 KB
testcase_50 AC 81 ms
13,032 KB
testcase_51 AC 114 ms
14,648 KB
testcase_52 AC 123 ms
14,548 KB
testcase_53 AC 103 ms
14,528 KB
testcase_54 AC 103 ms
14,496 KB
testcase_55 AC 117 ms
14,420 KB
testcase_56 AC 5 ms
10,260 KB
testcase_57 AC 6 ms
9,700 KB
testcase_58 AC 70 ms
13,364 KB
testcase_59 AC 87 ms
13,988 KB
testcase_60 AC 31 ms
11,936 KB
testcase_61 AC 75 ms
13,600 KB
testcase_62 AC 74 ms
13,496 KB
testcase_63 AC 5 ms
10,456 KB
testcase_64 AC 35 ms
12,076 KB
testcase_65 AC 28 ms
11,868 KB
testcase_66 AC 27 ms
11,640 KB
testcase_67 AC 54 ms
12,952 KB
testcase_68 AC 33 ms
11,996 KB
testcase_69 AC 13 ms
10,928 KB
testcase_70 AC 16 ms
11,076 KB
testcase_71 AC 16 ms
11,052 KB
testcase_72 AC 44 ms
12,408 KB
testcase_73 AC 89 ms
14,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

int a[200010]={},r[200010],col[200010]; vector<int> st[200010];

int main(){
    int n,m; scanf("%d%d",&n,&m);
    rep(i,0,m){
        int l; scanf("%d%d",&l,&r[i]); l--;
        char c; cin>>c;
        if(c=='Y')col[i]=1;
        if(c=='K')col[i]=2;
        if(c=='C')col[i]=3;
        st[l].push_back(i);
    }
    priority_queue<int,vector<int>,greater<int>> pq;
    rep(i,0,n){
        for(int j:st[i])pq.push(j);
        while(pq.size()){
            int j=pq.top();
            if(r[j]<=i){pq.pop(); continue;}
            a[i]=col[j]; break;
        }
    }
    int ans[3]={};
    rep(i,0,n)if(a[i])ans[a[i]-1]++;
    printf("%d %d %d\n",ans[0],ans[1],ans[2]);
    return 0;
}
0