結果

問題 No.945 YKC饅頭
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-06-18 20:02:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 456 ms / 2,000 ms
コード長 1,269 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 172,056 KB
実行使用メモリ 18,020 KB
最終ジャッジ日時 2023-09-16 12:19:03
合計ジャッジ時間 12,165 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 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,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 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,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 12 ms
4,380 KB
testcase_32 AC 4 ms
4,376 KB
testcase_33 AC 60 ms
5,872 KB
testcase_34 AC 200 ms
10,872 KB
testcase_35 AC 355 ms
15,176 KB
testcase_36 AC 359 ms
15,048 KB
testcase_37 AC 286 ms
13,984 KB
testcase_38 AC 254 ms
12,316 KB
testcase_39 AC 35 ms
4,552 KB
testcase_40 AC 25 ms
4,380 KB
testcase_41 AC 8 ms
4,376 KB
testcase_42 AC 368 ms
15,188 KB
testcase_43 AC 298 ms
13,860 KB
testcase_44 AC 252 ms
12,600 KB
testcase_45 AC 436 ms
17,084 KB
testcase_46 AC 3 ms
4,376 KB
testcase_47 AC 195 ms
10,696 KB
testcase_48 AC 38 ms
4,884 KB
testcase_49 AC 64 ms
5,968 KB
testcase_50 AC 429 ms
17,520 KB
testcase_51 AC 456 ms
17,772 KB
testcase_52 AC 428 ms
17,620 KB
testcase_53 AC 429 ms
17,912 KB
testcase_54 AC 450 ms
17,820 KB
testcase_55 AC 427 ms
18,020 KB
testcase_56 AC 2 ms
4,380 KB
testcase_57 AC 2 ms
4,376 KB
testcase_58 AC 134 ms
6,656 KB
testcase_59 AC 166 ms
7,520 KB
testcase_60 AC 54 ms
4,620 KB
testcase_61 AC 143 ms
6,944 KB
testcase_62 AC 136 ms
6,600 KB
testcase_63 AC 3 ms
4,380 KB
testcase_64 AC 59 ms
4,572 KB
testcase_65 AC 45 ms
4,384 KB
testcase_66 AC 43 ms
4,380 KB
testcase_67 AC 96 ms
5,596 KB
testcase_68 AC 56 ms
4,496 KB
testcase_69 AC 17 ms
4,376 KB
testcase_70 AC 21 ms
4,380 KB
testcase_71 AC 22 ms
4,380 KB
testcase_72 AC 76 ms
5,060 KB
testcase_73 AC 156 ms
7,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.06.18 20:02:41
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    vector< tuple< int, int, char > > a(m);
    vector< tuple< int, int, char, int > > b(m);
    for (int i = 0; i < m; i++) {
        int l, r;
        char t;
        cin >> l >> r >> t;
        l--;
        r--;
        a[i] = make_tuple(l, r, t);
        b[i] = make_tuple(l, r, t, i);
    }
    sort(b.begin(), b.end());
    set< pair< int, int > > st1;  
    set< int > st2;               
    int now = 0;
    int cnt_Y = 0, cnt_K = 0, cnt_C = 0;
    for (int i = 0; i < n; i++) {
        while (now < m && get< 0 >(b[now]) <= i) {
            st1.insert({get< 1 >(b[now]), get< 3 >(b[now])});
            st2.insert(get<3>(b[now]));
            now++;
        }
        while(!st1.empty() && (*st1.begin()).first < i) {
            st2.erase((*st1.begin()).second);
            st1.erase(st1.begin());
        }
        if (st2.empty()) continue;
        char c = get<2>(a[*st2.begin()]);
        if (c == 'Y') cnt_Y++;
        else if (c == 'K') cnt_K++;
        else cnt_C++;
    }
    cout << cnt_Y << " " << cnt_K << " " << cnt_C << endl;
    return 0;
}
0