結果

問題 No.945 YKC饅頭
ユーザー risujiroh
提出日時 2019-12-08 00:03:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 172,612 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-12-26 18:17:33
合計ジャッジ時間 8,884 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 74
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  set<int> se;
  for (int i = 0; i < n; ++i) {
    se.insert(i);
  }
  string s(n, '?');
  while (m--) {
    int l, r;
    char c;
    cin >> l >> r >> c;
    --l;
    auto it = se.lower_bound(l);
    while (it != end(se) and *it < r) {
      s[*it] = c;
      it = se.erase(it);
    }
  }
  string t = "YKC";
  for (int k = 0; k < 3; ++k) {
    cout << count(begin(s), end(s), t[k]) << " \n"[k == 2];
  }
}
0