結果

問題 No.945 YKC饅頭
ユーザー kcvlexkcvlex
提出日時 2019-12-21 01:00:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 283 ms / 2,000 ms
コード長 2,445 bytes
コンパイル時間 1,624 ms
コンパイル使用メモリ 176,824 KB
実行使用メモリ 25,344 KB
最終ジャッジ日時 2023-09-25 07:05:22
合計ジャッジ時間 12,380 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 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,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 9 ms
5,368 KB
testcase_32 AC 7 ms
8,992 KB
testcase_33 AC 43 ms
12,496 KB
testcase_34 AC 131 ms
14,064 KB
testcase_35 AC 225 ms
22,360 KB
testcase_36 AC 154 ms
11,460 KB
testcase_37 AC 142 ms
11,212 KB
testcase_38 AC 131 ms
11,676 KB
testcase_39 AC 25 ms
9,040 KB
testcase_40 AC 19 ms
11,288 KB
testcase_41 AC 9 ms
8,340 KB
testcase_42 AC 190 ms
17,152 KB
testcase_43 AC 125 ms
10,424 KB
testcase_44 AC 159 ms
18,404 KB
testcase_45 AC 220 ms
16,776 KB
testcase_46 AC 5 ms
6,264 KB
testcase_47 AC 120 ms
14,584 KB
testcase_48 AC 20 ms
5,144 KB
testcase_49 AC 44 ms
10,900 KB
testcase_50 AC 225 ms
18,112 KB
testcase_51 AC 268 ms
25,344 KB
testcase_52 AC 283 ms
25,240 KB
testcase_53 AC 268 ms
25,340 KB
testcase_54 AC 268 ms
25,288 KB
testcase_55 AC 270 ms
25,240 KB
testcase_56 AC 8 ms
12,400 KB
testcase_57 AC 7 ms
12,284 KB
testcase_58 AC 107 ms
18,936 KB
testcase_59 AC 134 ms
20,052 KB
testcase_60 AC 46 ms
15,564 KB
testcase_61 AC 127 ms
19,152 KB
testcase_62 AC 118 ms
19,072 KB
testcase_63 AC 8 ms
12,664 KB
testcase_64 AC 47 ms
15,740 KB
testcase_65 AC 40 ms
15,044 KB
testcase_66 AC 38 ms
14,976 KB
testcase_67 AC 85 ms
17,280 KB
testcase_68 AC 47 ms
15,632 KB
testcase_69 AC 20 ms
13,328 KB
testcase_70 AC 22 ms
13,652 KB
testcase_71 AC 21 ms
13,724 KB
testcase_72 AC 70 ms
16,644 KB
testcase_73 AC 135 ms
19,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

int main() {
    const ll inf = 5e15;
    ll N, M;
    cin >> N >> M;
    VV<ll> add(N + 10), dec(N + 10);
    V<char> kinds(M);
    for(ll i = 0; i < M; i++) {
        ll l, r;
        cin >> l >> r >> kinds[i];
        add[l - 1].push_back(i);
        dec[r].push_back(i);
    }

    ll y = 0, k = 0, c = 0;
    set<ll> idx_s;
    idx_s.insert(inf);
    for(ll i = 0; i < N; i++) {
        for(ll e : add[i]) idx_s.insert(e);
        for(ll e : dec[i]) idx_s.erase(e);
        ll idx = *idx_s.begin();
        if(idx == inf) continue;
        if(kinds[idx] == 'Y') y++;
        if(kinds[idx] == 'K') k++;
        if(kinds[idx] == 'C') c++;
    }

    cout << y << ' ' << k << ' ' << c << endl;
    return 0;
}
0