結果

問題 No.945 YKC饅頭
ユーザー MayimgMayimg
提出日時 2020-07-24 22:46:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 754 bytes
コンパイル時間 2,269 ms
コンパイル使用メモリ 217,864 KB
実行使用メモリ 25,120 KB
最終ジャッジ日時 2023-09-08 05:11:12
合計ジャッジ時間 12,200 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,376 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,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 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,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,380 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,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 10 ms
5,360 KB
testcase_32 AC 7 ms
8,860 KB
testcase_33 AC 42 ms
12,300 KB
testcase_34 AC 138 ms
14,020 KB
testcase_35 AC 234 ms
22,048 KB
testcase_36 AC 163 ms
11,412 KB
testcase_37 AC 148 ms
10,864 KB
testcase_38 AC 137 ms
11,712 KB
testcase_39 AC 27 ms
9,012 KB
testcase_40 AC 24 ms
11,244 KB
testcase_41 AC 9 ms
8,256 KB
testcase_42 AC 209 ms
17,044 KB
testcase_43 AC 138 ms
10,292 KB
testcase_44 AC 173 ms
18,136 KB
testcase_45 AC 246 ms
16,480 KB
testcase_46 AC 5 ms
6,128 KB
testcase_47 AC 128 ms
14,544 KB
testcase_48 AC 23 ms
5,076 KB
testcase_49 AC 50 ms
10,792 KB
testcase_50 AC 261 ms
18,032 KB
testcase_51 AC 281 ms
25,120 KB
testcase_52 AC 280 ms
25,068 KB
testcase_53 AC 287 ms
24,916 KB
testcase_54 AC 282 ms
24,916 KB
testcase_55 AC 285 ms
25,012 KB
testcase_56 AC 7 ms
12,540 KB
testcase_57 AC 6 ms
12,388 KB
testcase_58 AC 101 ms
18,728 KB
testcase_59 AC 130 ms
19,744 KB
testcase_60 AC 41 ms
15,516 KB
testcase_61 AC 113 ms
18,916 KB
testcase_62 AC 103 ms
18,684 KB
testcase_63 AC 8 ms
12,616 KB
testcase_64 AC 45 ms
15,732 KB
testcase_65 AC 36 ms
14,992 KB
testcase_66 AC 33 ms
14,988 KB
testcase_67 AC 70 ms
17,436 KB
testcase_68 AC 45 ms
15,424 KB
testcase_69 AC 17 ms
13,316 KB
testcase_70 AC 21 ms
13,632 KB
testcase_71 AC 20 ms
13,648 KB
testcase_72 AC 57 ms
16,488 KB
testcase_73 AC 121 ms
19,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
map<char, int> conv = {{'Y', 0}, {'K', 1}, {'C', 2}};
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<pair<int, int>>> a(n + 1), b(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    char ch;
    cin >> ch;
    a[l].emplace_back(i, conv[ch]);
    b[r + 1].emplace_back(i, conv[ch]);
  }
  set<pair<int, int>> st;
  vector<int> ans(3);
  for (int i = 0; i < n; i++) {
    for (auto& p : b[i]) st.erase(p);
    for (auto& p : a[i]) st.insert(p);
    if (st.empty()) continue;
    ans[st.begin()->second]++;
  }
  cout << ans[0] << " " << ans[1] << " " << ans[2] << endl;
  return 0;
}
0