結果

問題 No.945 YKC饅頭
ユーザー eSeF
提出日時 2020-07-14 22:30:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 603 bytes
コンパイル時間 1,981 ms
コンパイル使用メモリ 199,148 KB
最終ジャッジ日時 2025-01-11 20:40:42
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 RE * 19 TLE * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:14: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type’ {aka ‘int’} [-Wformat=]
   27 |   printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]);
      |           ~~~^
      |              |
      |              long long int
      |           %d
main.cpp:27:19: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type’ {aka ‘int’} [-Wformat=]
   27 |   printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]);
      |                ~~~^
      |                   |
      |                   long long int
      |                %d
main.cpp:27:24: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type’ {aka ‘int’} [-Wformat=]
   27 |   printf("%lld %lld %lld\n",ans[0],ans[1],ans[2]);
      |                     ~~~^
      |                        |
      |                        long long int
      |                     %d

ソースコード

diff #

#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){
    int L,R;char T;
    cin >> L >> R >> T;
    L--;R--;
    auto itr = lower_bound(res.begin(),res.end(),L);
    while (L<=(*itr)&&(*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