結果

問題 No.945 YKC饅頭
ユーザー Akidai16Akidai16
提出日時 2022-12-06 00:47:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,806 bytes
コンパイル時間 4,304 ms
コンパイル使用メモリ 263,468 KB
実行使用メモリ 43,964 KB
最終ジャッジ日時 2024-04-20 22:20:12
合計ジャッジ時間 19,416 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 RE -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 RE -
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 AC 135 ms
24,604 KB
testcase_35 AC 274 ms
37,984 KB
testcase_36 AC 170 ms
33,492 KB
testcase_37 AC 173 ms
31,344 KB
testcase_38 AC 139 ms
26,132 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 220 ms
35,716 KB
testcase_43 AC 152 ms
31,320 KB
testcase_44 AC 162 ms
29,372 KB
testcase_45 AC 212 ms
37,928 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 AC 31 ms
8,308 KB
testcase_49 RE -
testcase_50 AC 236 ms
39,380 KB
testcase_51 AC 317 ms
43,288 KB
testcase_52 RE -
testcase_53 AC 292 ms
43,392 KB
testcase_54 RE -
testcase_55 AC 341 ms
43,412 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)
#define All(A) A.begin(), A.end()
#define rAll(A) A.rbegin(), A.rend()

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int N, M;
vvi Q;

void solve() {
    vi ans(N, -1);
    reverse(All(Q));
    vector<vvi> A(N);
    REP(i, 0, M) {
        int l = Q[i][0], r = Q[i][1], c = Q[i][2];
        A[l].push_back({i, r, c});
    }
    priority_queue<vi> P;
    REP(i, 0, N) {
        for(vi a: A[i]) {
            P.push(a);
            // cout << "pushed: " << a[0] << " " << a[1] << " " << a[2] << endl;
        }
        vi top = P.top();
        int priority = top[0], r = top[1], c = top[2];
        // cout << priority << " " << r << " " << c << endl;
        while(r < i) {
            P.pop();
            if(P.empty()) {
                c = -1;
                break;
            }
            top = P.top();
            priority = top[0], r = top[1], c = top[2];
        }
        ans[i] = c;
        /*
        REP(i, 0, N) cout << ans[i] << " ";
        cout << endl;
        */
    }
    vi cnt(3, 0);
    REP(i, 0, N) {
        if(ans[i] == -1) continue;
        cnt[ans[i]]++;
    }
    REP(i, 0, 3) {
        cout << cnt[i] << " ";
    }
    cout << endl;
}

int main() {
    cin >> N >> M;
    Q.resize(M);
    REP(i, 0, M) {
        int l, r;
        char t;
        cin >> l >> r >> t;
        l--; r--;
        int c = 0;
        if(t == 'K') c = 1;
        if(t == 'C') c = 2;
        Q[i] = {l, r, c};
    }
    solve();
}
0