結果

問題 No.945 YKC饅頭
コンテスト
ユーザー eSeF
提出日時 2020-07-14 22:39:39
言語 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
結果
TLE  
実行時間 -
コード長 660 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,942 ms
コンパイル使用メモリ 216,092 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2026-06-11 09:13:40
合計ジャッジ時間 8,080 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 58 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

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 = lower_bound(res.begin(),res.end(),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]++;
      if(res.empty())break;
    }
  }
  printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]);
  return 0;
}
0