結果

問題 No.945 YKC饅頭
ユーザー coco18000coco18000
提出日時 2019-12-08 01:03:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 688 ms / 2,000 ms
コード長 1,407 bytes
コンパイル時間 2,099 ms
コンパイル使用メモリ 181,420 KB
実行使用メモリ 48,408 KB
最終ジャッジ日時 2023-08-27 14:32:27
合計ジャッジ時間 18,719 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 2 ms
4,388 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 3 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 34 ms
9,656 KB
testcase_32 AC 72 ms
22,900 KB
testcase_33 AC 166 ms
27,952 KB
testcase_34 AC 289 ms
25,000 KB
testcase_35 AC 561 ms
42,948 KB
testcase_36 AC 213 ms
18,964 KB
testcase_37 AC 222 ms
19,424 KB
testcase_38 AC 265 ms
17,848 KB
testcase_39 AC 101 ms
18,980 KB
testcase_40 AC 125 ms
28,028 KB
testcase_41 AC 68 ms
19,704 KB
testcase_42 AC 414 ms
29,100 KB
testcase_43 AC 160 ms
16,704 KB
testcase_44 AC 484 ms
34,884 KB
testcase_45 AC 427 ms
26,812 KB
testcase_46 AC 40 ms
14,188 KB
testcase_47 AC 307 ms
26,900 KB
testcase_48 AC 45 ms
7,228 KB
testcase_49 AC 150 ms
22,440 KB
testcase_50 AC 484 ms
29,792 KB
testcase_51 AC 668 ms
48,272 KB
testcase_52 AC 688 ms
48,284 KB
testcase_53 AC 663 ms
48,408 KB
testcase_54 AC 642 ms
48,232 KB
testcase_55 AC 688 ms
48,244 KB
testcase_56 AC 129 ms
34,856 KB
testcase_57 AC 131 ms
34,928 KB
testcase_58 AC 448 ms
42,232 KB
testcase_59 AC 539 ms
43,780 KB
testcase_60 AC 246 ms
38,180 KB
testcase_61 AC 483 ms
42,756 KB
testcase_62 AC 454 ms
42,516 KB
testcase_63 AC 111 ms
34,972 KB
testcase_64 AC 255 ms
38,416 KB
testcase_65 AC 222 ms
37,676 KB
testcase_66 AC 219 ms
37,544 KB
testcase_67 AC 357 ms
40,344 KB
testcase_68 AC 250 ms
38,488 KB
testcase_69 AC 152 ms
35,828 KB
testcase_70 AC 164 ms
36,148 KB
testcase_71 AC 162 ms
36,204 KB
testcase_72 AC 289 ms
39,228 KB
testcase_73 AC 505 ms
43,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

map<ll, vector<pll>> L;
map<ll, vector<pll>> R;
ll A[3];
bool U[200005];

int main() {
    ll N, M;
    cin >> N >> M;

    REP(i, M) {
        ll l, r;
        char c;
        cin >> l >> r >> c;
        l--;
        ll t = 0;
        if (c == 'Y')
            t = 0;
        else if (c == 'K')
            t = 1;
        else
            t = 2;
        L[l].push_back(pll(i, t));
        R[r].push_back(pll(i, t));
    }

    memset(A, 0, sizeof(A));
    memset(U, 0, sizeof(U));
    priority_queue<pll, vector<pll>, function<bool(pll, pll)>> q([](pll a, pll b) { return a.first > b.first; });
    REP(i, N) {
        auto rv = R[i];
        REP(j, rv.size()) {
            U[rv[j].first] = false;
        }
        auto lv = L[i];
        REP(j, lv.size()) {
            U[lv[j].first] = true;
            q.push(lv[j]);
        }

        while (!q.empty()) {
            pll t = q.top();
            if (!U[t.first]) {
                q.pop();
                continue;
            }
            A[t.second]++;
            break;
        }
    }

    REP(i, 3) {
        cout << A[i] << " ";
    }
    cout << endl;
    return 0;
}
0