結果

問題 No.945 YKC饅頭
ユーザー commycommy
提出日時 2020-04-05 02:10:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 2,660 bytes
コンパイル時間 1,190 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 7,384 KB
最終ジャッジ日時 2023-09-16 06:22:45
合計ジャッジ時間 10,417 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 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,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 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,376 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,380 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 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 11 ms
4,376 KB
testcase_32 AC 22 ms
5,088 KB
testcase_33 AC 49 ms
7,260 KB
testcase_34 AC 69 ms
5,104 KB
testcase_35 AC 122 ms
7,136 KB
testcase_36 AC 61 ms
4,376 KB
testcase_37 AC 57 ms
4,376 KB
testcase_38 AC 58 ms
4,380 KB
testcase_39 AC 30 ms
5,096 KB
testcase_40 AC 38 ms
7,132 KB
testcase_41 AC 22 ms
5,088 KB
testcase_42 AC 93 ms
5,088 KB
testcase_43 AC 50 ms
4,380 KB
testcase_44 AC 95 ms
7,176 KB
testcase_45 AC 94 ms
5,144 KB
testcase_46 AC 14 ms
5,224 KB
testcase_47 AC 71 ms
5,144 KB
testcase_48 AC 14 ms
4,376 KB
testcase_49 AC 41 ms
5,108 KB
testcase_50 AC 104 ms
5,224 KB
testcase_51 AC 144 ms
7,144 KB
testcase_52 AC 145 ms
7,188 KB
testcase_53 AC 144 ms
7,136 KB
testcase_54 AC 144 ms
7,144 KB
testcase_55 AC 144 ms
7,180 KB
testcase_56 AC 36 ms
7,200 KB
testcase_57 AC 36 ms
7,384 KB
testcase_58 AC 79 ms
7,288 KB
testcase_59 AC 89 ms
7,292 KB
testcase_60 AC 54 ms
7,200 KB
testcase_61 AC 81 ms
7,128 KB
testcase_62 AC 80 ms
7,156 KB
testcase_63 AC 36 ms
7,188 KB
testcase_64 AC 56 ms
7,192 KB
testcase_65 AC 51 ms
7,208 KB
testcase_66 AC 51 ms
7,176 KB
testcase_67 AC 68 ms
7,132 KB
testcase_68 AC 55 ms
7,176 KB
testcase_69 AC 41 ms
7,184 KB
testcase_70 AC 43 ms
7,152 KB
testcase_71 AC 43 ms
7,132 KB
testcase_72 AC 59 ms
7,176 KB
testcase_73 AC 86 ms
7,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<int, int>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <functional>
template<typename T>
class SegmentTreeAllOne {
    using Func = function<T(T, T)>;

public:
    vector<T> data;
    int n;
    T init;
    Func update_func;
    SegmentTreeAllOne(int _n, T _init, Func up) {
        init = _init;
        update_func = up;
        for (n = 1; n < _n; n *= 2)
            ;
        data.resize(2 * n - 1, init);
    }
    void update(int l, int r, T val) {
        for (l += n - 1, r += n - 1; l < r; l = l / 2, r = (r - 1) / 2) {
            if (!(l & 1)) {
                data[l] = update_func(data[l], val);
            }
            if (!(r & 1)) {
                data[r - 1] = update_func(data[r - 1], val);
            }
        }
    }
    T query(int pos) {
        pos += n - 1;
        T res = data[pos];
        while (pos > 0) {
            pos = (pos - 1) / 2;
            res = update_func(res, data[pos]);
        }
        return res;
    }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin, n, m;
    auto MIN = [](P a, P b) {
        return min(a, b);
    };
    SegmentTreeAllOne<P> seg(n, P(m + 1, 0), MIN);
    REP(i, 0, m) {
        int l, r;
        char t;
        cin, l, r, t;
        seg.update(l - 1, r, P(i, t));
    }
    int cnt[128] = {0};
    REP(i, 0, n) {
        cnt[seg.query(i).second]++;
    }
    print(cnt['Y'], cnt['K'], cnt['C']);

    return 0;
}
0