結果

問題 No.945 YKC饅頭
ユーザー milanis48663220milanis48663220
提出日時 2019-12-08 01:13:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 13,484 KB
最終ジャッジ日時 2023-08-27 14:56:02
合計ジャッジ時間 7,449 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 13 ms
5,428 KB
testcase_32 AC 45 ms
9,412 KB
testcase_33 AC 58 ms
10,192 KB
testcase_34 AC 52 ms
7,988 KB
testcase_35 AC 96 ms
12,052 KB
testcase_36 AC 30 ms
4,376 KB
testcase_37 AC 31 ms
4,376 KB
testcase_38 AC 35 ms
5,300 KB
testcase_39 AC 35 ms
7,760 KB
testcase_40 AC 58 ms
10,788 KB
testcase_41 AC 36 ms
8,200 KB
testcase_42 AC 61 ms
7,856 KB
testcase_43 AC 26 ms
4,376 KB
testcase_44 AC 79 ms
10,604 KB
testcase_45 AC 56 ms
6,692 KB
testcase_46 AC 24 ms
6,796 KB
testcase_47 AC 56 ms
8,408 KB
testcase_48 AC 9 ms
4,376 KB
testcase_49 AC 44 ms
8,436 KB
testcase_50 AC 64 ms
7,592 KB
testcase_51 AC 112 ms
12,880 KB
testcase_52 AC 120 ms
12,940 KB
testcase_53 AC 114 ms
12,952 KB
testcase_54 AC 113 ms
13,092 KB
testcase_55 AC 115 ms
12,900 KB
testcase_56 AC 74 ms
13,484 KB
testcase_57 AC 58 ms
13,004 KB
testcase_58 AC 163 ms
12,788 KB
testcase_59 AC 174 ms
12,752 KB
testcase_60 AC 129 ms
13,008 KB
testcase_61 AC 167 ms
12,812 KB
testcase_62 AC 165 ms
12,944 KB
testcase_63 AC 57 ms
12,824 KB
testcase_64 AC 132 ms
12,756 KB
testcase_65 AC 121 ms
12,924 KB
testcase_66 AC 118 ms
12,788 KB
testcase_67 AC 149 ms
12,764 KB
testcase_68 AC 125 ms
12,724 KB
testcase_69 AC 85 ms
12,924 KB
testcase_70 AC 99 ms
12,872 KB
testcase_71 AC 93 ms
12,812 KB
testcase_72 AC 140 ms
12,764 KB
testcase_73 AC 189 ms
12,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N, M;
    cin >> N >> M;
    set<int> st;
    int y = 0, k = 0, c = 0;
    for(int i = 0; i < N; i++){
        st.insert(i+1);
    }
    for(int i = 0; i < M; i++){
        int L, R;
        char T;
        cin >> L >> R >> T;
        auto p = st.lower_bound(L);
        vector<int> v;
        for(auto iter = p; iter != st.end() && *iter <= R; iter++){
            if(T == 'Y') y++;
            if(T == 'K') k++;
            if(T == 'C') c++;
            v.push_back(*iter);
        }
        for(auto iter = v.begin(); iter != v.end(); iter++) st.erase(*iter);
    }
    cout << y << ' ' << k << ' ' << c << endl;
}
0