結果

問題 No.945 YKC饅頭
ユーザー iqueue02iqueue02
提出日時 2019-12-11 16:07:11
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 182,100 KB
実行使用メモリ 17,240 KB
最終ジャッジ日時 2023-09-06 13:05:38
合計ジャッジ時間 8,414 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 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,380 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 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 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,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 9 ms
4,536 KB
testcase_32 AC 4 ms
6,348 KB
testcase_33 AC 37 ms
8,984 KB
testcase_34 AC 87 ms
9,640 KB
testcase_35 AC 163 ms
14,672 KB
testcase_36 AC 105 ms
9,692 KB
testcase_37 AC 99 ms
9,680 KB
testcase_38 AC 91 ms
8,360 KB
testcase_39 AC 24 ms
6,728 KB
testcase_40 AC 20 ms
8,364 KB
testcase_41 AC 7 ms
6,100 KB
testcase_42 AC 130 ms
12,080 KB
testcase_43 AC 88 ms
9,324 KB
testcase_44 AC 109 ms
11,580 KB
testcase_45 AC 140 ms
11,824 KB
testcase_46 AC 4 ms
4,908 KB
testcase_47 AC 86 ms
9,832 KB
testcase_48 AC 21 ms
4,572 KB
testcase_49 AC 41 ms
7,988 KB
testcase_50 AC 150 ms
12,604 KB
testcase_51 AC 191 ms
15,980 KB
testcase_52 AC 201 ms
17,240 KB
testcase_53 AC 178 ms
15,976 KB
testcase_54 AC 174 ms
16,060 KB
testcase_55 AC 203 ms
16,240 KB
testcase_56 AC 5 ms
8,532 KB
testcase_57 AC 4 ms
8,444 KB
testcase_58 AC 118 ms
11,720 KB
testcase_59 AC 146 ms
12,372 KB
testcase_60 AC 51 ms
10,108 KB
testcase_61 AC 129 ms
11,972 KB
testcase_62 AC 123 ms
11,752 KB
testcase_63 AC 6 ms
8,464 KB
testcase_64 AC 58 ms
10,068 KB
testcase_65 AC 44 ms
10,024 KB
testcase_66 AC 41 ms
9,900 KB
testcase_67 AC 88 ms
11,376 KB
testcase_68 AC 54 ms
10,176 KB
testcase_69 AC 19 ms
9,164 KB
testcase_70 AC 24 ms
9,436 KB
testcase_71 AC 23 ms
9,428 KB
testcase_72 AC 68 ms
10,576 KB
testcase_73 AC 138 ms
12,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9;

int main(){
  int n, m;
  cin >> n >> m;
  
  priority_queue<pair<int,P>, vector<pair<int,P>>, greater<>> que;
  vector<vector<pair<int,P>>> ykc(n);
  map<char,int> mp;

  mp['Y'] = 0;
  mp['K'] = 1;
  mp['C'] = 2;

  rep(i,m) {
   int l, r;
   char c;
   cin >> l >> r >> c;
   int num = mp[c];
   l--; r--;
   ykc[l].emplace_back(make_pair(i,make_pair(r,num)));
  }

  vector<int> check(n,0), res(3,0);

  for (int i = 0; i < n; i++) {
    for (auto e : ykc[i]) que.push(e);

    while (!que.empty() && !check[i]) {
      auto p = que.top(); 
      if (p.second.first < i) que.pop();
      else {
        check[i] = 1;
        res[p.second.second]++;
      }  
    }  
  }
  for (auto ans : res) cout << ans << " ";
  cout << endl;
  return 0;
}
0