結果

問題 No.945 YKC饅頭
コンテスト
ユーザー eSeF
提出日時 2020-07-14 22:41:50
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 614 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,449 ms
コンパイル使用メモリ 215,752 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2026-06-11 09:13:55
合計ジャッジ時間 6,633 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 74
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = (ll) 1e18;
int main()
{
  int N,M;
  cin >> N >> M;
  set<int>res;
  rep(i,N)res.insert(i);
  vector<int>ans(3,0);
  rep(i,M){
    if(res.empty())break;
    int L,R;char T;
    cin >> L >> R >> T;
    L--;R--;
    auto itr = res.lower_bound(L);
    while (itr!=res.end()&&*itr<=R)
    {
      itr=res.erase(itr);
      if(T=='Y')ans[0]++;
      if(T=='K')ans[1]++;
      if(T=='C')ans[2]++;
    }
  }
  printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]);
  return 0;
}
0