結果

問題 No.945 YKC饅頭
ユーザー ngtkanangtkana
提出日時 2020-04-14 22:05:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 1,138 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 203,604 KB
実行使用メモリ 19,060 KB
最終ジャッジ日時 2024-04-09 18:14:33
合計ジャッジ時間 7,276 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 3 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 7 ms
6,940 KB
testcase_32 AC 5 ms
6,940 KB
testcase_33 AC 27 ms
9,372 KB
testcase_34 AC 66 ms
11,300 KB
testcase_35 AC 129 ms
17,024 KB
testcase_36 AC 58 ms
11,352 KB
testcase_37 AC 58 ms
11,136 KB
testcase_38 AC 60 ms
10,120 KB
testcase_39 AC 18 ms
7,168 KB
testcase_40 AC 16 ms
8,040 KB
testcase_41 AC 7 ms
6,944 KB
testcase_42 AC 99 ms
14,208 KB
testcase_43 AC 46 ms
10,196 KB
testcase_44 AC 93 ms
13,500 KB
testcase_45 AC 100 ms
14,148 KB
testcase_46 AC 4 ms
6,940 KB
testcase_47 AC 67 ms
11,384 KB
testcase_48 AC 14 ms
6,944 KB
testcase_49 AC 28 ms
8,412 KB
testcase_50 AC 107 ms
14,992 KB
testcase_51 AC 151 ms
18,804 KB
testcase_52 AC 158 ms
18,932 KB
testcase_53 AC 140 ms
18,828 KB
testcase_54 AC 138 ms
18,928 KB
testcase_55 AC 164 ms
19,060 KB
testcase_56 AC 5 ms
7,884 KB
testcase_57 AC 6 ms
7,772 KB
testcase_58 AC 90 ms
14,192 KB
testcase_59 AC 114 ms
15,396 KB
testcase_60 AC 39 ms
11,176 KB
testcase_61 AC 100 ms
14,532 KB
testcase_62 AC 93 ms
14,400 KB
testcase_63 AC 7 ms
8,016 KB
testcase_64 AC 45 ms
11,496 KB
testcase_65 AC 34 ms
10,700 KB
testcase_66 AC 33 ms
10,584 KB
testcase_67 AC 70 ms
13,028 KB
testcase_68 AC 40 ms
11,272 KB
testcase_69 AC 16 ms
9,016 KB
testcase_70 AC 18 ms
9,484 KB
testcase_71 AC 19 ms
9,416 KB
testcase_72 AC 58 ms
12,168 KB
testcase_73 AC 106 ms
14,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
using lint=long long;
using ld=long double;
template<class T>using numr=std::numeric_limits<T>;
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n,m;std::cin>>n>>m;
    std::string s(m+1,'$');
    std::vector<std::vector<lint>>events(n+1);
    for(lint i=0;i<m;i++){
        lint l,r;std::cin>>l>>r;l--;
        std::cin>>s.at(i);
        events.at(l).push_back(i);
        events.at(r).push_back(-i-1);
    }
    events.at(0).push_back(m);
    events.at(n).push_back(-m-1);
    std::vector<lint>ckd(m+1);
    std::priority_queue<lint>que;
    lint y=0,k=0,c=0,z=0;
    for(lint i=0;i<n;i++){
        for(lint x:events.at(i)){
            if(0<=x){
                que.push(-x);
                ckd.at(x)=true;
            }else{
                ckd.at(-x-1)=false;
            }
            while(!ckd.at(-que.top()))que.pop();
        }
        char now=s.at(-que.top());
        (now=='Y'?y:now=='K'?k:now=='C'?c:z)++;
    }
    std::cout<<y<<' '<<k<<' '<<c<<'\n';
}
0