結果

問題 No.945 YKC饅頭
ユーザー ngtkanangtkana
提出日時 2020-04-14 22:02:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 1,145 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 203,200 KB
実行使用メモリ 18,936 KB
最終ジャッジ日時 2024-04-09 18:14:16
合計ジャッジ時間 7,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 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 8 ms
6,940 KB
testcase_32 AC 5 ms
6,944 KB
testcase_33 AC 30 ms
9,216 KB
testcase_34 AC 71 ms
11,304 KB
testcase_35 AC 140 ms
16,972 KB
testcase_36 AC 58 ms
11,356 KB
testcase_37 AC 58 ms
11,260 KB
testcase_38 AC 64 ms
10,128 KB
testcase_39 AC 18 ms
7,040 KB
testcase_40 AC 17 ms
8,192 KB
testcase_41 AC 8 ms
6,944 KB
testcase_42 AC 104 ms
14,336 KB
testcase_43 AC 46 ms
10,332 KB
testcase_44 AC 100 ms
13,628 KB
testcase_45 AC 113 ms
14,144 KB
testcase_46 AC 4 ms
6,940 KB
testcase_47 AC 74 ms
11,508 KB
testcase_48 AC 14 ms
6,944 KB
testcase_49 AC 31 ms
8,508 KB
testcase_50 AC 121 ms
15,120 KB
testcase_51 AC 168 ms
18,812 KB
testcase_52 AC 177 ms
18,932 KB
testcase_53 AC 159 ms
18,820 KB
testcase_54 AC 154 ms
18,756 KB
testcase_55 AC 181 ms
18,936 KB
testcase_56 AC 5 ms
7,920 KB
testcase_57 AC 5 ms
7,880 KB
testcase_58 AC 102 ms
14,260 KB
testcase_59 AC 126 ms
15,324 KB
testcase_60 AC 45 ms
11,148 KB
testcase_61 AC 110 ms
14,536 KB
testcase_62 AC 105 ms
14,192 KB
testcase_63 AC 5 ms
7,912 KB
testcase_64 AC 48 ms
11,400 KB
testcase_65 AC 39 ms
10,724 KB
testcase_66 AC 37 ms
10,512 KB
testcase_67 AC 81 ms
12,984 KB
testcase_68 AC 47 ms
11,284 KB
testcase_69 AC 15 ms
9,024 KB
testcase_70 AC 19 ms
9,436 KB
testcase_71 AC 20 ms
9,416 KB
testcase_72 AC 63 ms
12,152 KB
testcase_73 AC 119 ms
14,928 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+1);
        events.at(r).push_back(-i-1);
    }
    events.at(0).push_back(m+1);
    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+1);
                ckd.at(x-1)=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