結果

問題 No.945 YKC饅頭
ユーザー 👑 hitonanodehitonanode
提出日時 2019-12-08 00:50:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 759 ms
コンパイル使用メモリ 80,288 KB
実行使用メモリ 24,292 KB
最終ジャッジ日時 2023-08-27 13:41:22
合計ジャッジ時間 10,637 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 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,380 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 3 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 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,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 13 ms
5,400 KB
testcase_32 AC 8 ms
8,740 KB
testcase_33 AC 63 ms
12,576 KB
testcase_34 AC 178 ms
13,580 KB
testcase_35 AC 312 ms
21,316 KB
testcase_36 AC 224 ms
9,620 KB
testcase_37 AC 205 ms
9,620 KB
testcase_38 AC 185 ms
10,712 KB
testcase_39 AC 36 ms
9,056 KB
testcase_40 AC 30 ms
11,260 KB
testcase_41 AC 12 ms
8,360 KB
testcase_42 AC 283 ms
15,712 KB
testcase_43 AC 184 ms
8,464 KB
testcase_44 AC 229 ms
17,696 KB
testcase_45 AC 323 ms
14,792 KB
testcase_46 AC 6 ms
6,292 KB
testcase_47 AC 176 ms
14,232 KB
testcase_48 AC 31 ms
4,920 KB
testcase_49 AC 66 ms
10,608 KB
testcase_50 AC 341 ms
16,276 KB
testcase_51 AC 392 ms
24,252 KB
testcase_52 AC 416 ms
24,292 KB
testcase_53 AC 399 ms
24,256 KB
testcase_54 AC 405 ms
24,256 KB
testcase_55 AC 395 ms
24,264 KB
testcase_56 AC 8 ms
12,256 KB
testcase_57 AC 9 ms
12,340 KB
testcase_58 AC 173 ms
18,344 KB
testcase_59 AC 214 ms
19,424 KB
testcase_60 AC 73 ms
15,380 KB
testcase_61 AC 185 ms
18,688 KB
testcase_62 AC 174 ms
18,772 KB
testcase_63 AC 9 ms
12,516 KB
testcase_64 AC 81 ms
16,032 KB
testcase_65 AC 63 ms
15,020 KB
testcase_66 AC 59 ms
15,080 KB
testcase_67 AC 125 ms
17,432 KB
testcase_68 AC 76 ms
15,548 KB
testcase_69 AC 26 ms
13,444 KB
testcase_70 AC 32 ms
13,656 KB
testcase_71 AC 33 ms
13,524 KB
testcase_72 AC 100 ms
16,360 KB
testcase_73 AC 199 ms
19,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
#include <vector>
using namespace std;

int main()
{
    int N, M;
    std::cin >> N >> M;
    vector<vector<int>> madd(N + 1), mdel(N + 1);
    for (int t = 0; t < M; t++) {
        int L, R;
        char T;
        cin >> L >> R >> T;
        int a = 0;
        if (T == 'K') a = 1;
        if (T == 'C') a = 2;
        madd[L - 1].push_back(a + t * 3);
        mdel[R].push_back(a + t * 3);
    }
    vector<int> ret(3);
    set<int> s;
    for (int i = 0; i < N; i++) {
        s.insert(madd[i].begin(), madd[i].end());
        for (auto x : mdel[i]) s.erase(x);
        if (!s.empty()) ret[*s.begin() % 3]++;
    }
    for (auto x : ret) cout << x << " ";
}
0