結果

問題 No.1557 Binary Variable
ユーザー ocvret_ocvret_
提出日時 2021-06-26 18:20:27
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 2,350 ms
コンパイル使用メモリ 170,240 KB
実行使用メモリ 4,760 KB
最終ジャッジ日時 2023-09-07 15:25:37
合計ジャッジ時間 7,907 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
4,516 KB
testcase_01 AC 134 ms
4,568 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 89 ms
4,632 KB
testcase_05 AC 88 ms
4,568 KB
testcase_06 AC 84 ms
4,616 KB
testcase_07 AC 85 ms
4,632 KB
testcase_08 AC 96 ms
4,512 KB
testcase_09 AC 97 ms
4,512 KB
testcase_10 AC 107 ms
4,632 KB
testcase_11 AC 108 ms
4,620 KB
testcase_12 AC 97 ms
4,676 KB
testcase_13 AC 108 ms
4,576 KB
testcase_14 AC 119 ms
4,692 KB
testcase_15 AC 109 ms
4,604 KB
testcase_16 AC 118 ms
4,576 KB
testcase_17 AC 117 ms
4,568 KB
testcase_18 AC 116 ms
4,600 KB
testcase_19 AC 129 ms
4,692 KB
testcase_20 AC 127 ms
4,572 KB
testcase_21 AC 127 ms
4,568 KB
testcase_22 AC 129 ms
4,604 KB
testcase_23 AC 126 ms
4,576 KB
testcase_24 AC 133 ms
4,760 KB
testcase_25 AC 132 ms
4,572 KB
testcase_26 AC 136 ms
4,692 KB
testcase_27 AC 137 ms
4,680 KB
testcase_28 AC 140 ms
4,524 KB
testcase_29 AC 148 ms
4,600 KB
testcase_30 AC 145 ms
4,600 KB
testcase_31 AC 149 ms
4,564 KB
testcase_32 AC 147 ms
4,612 KB
testcase_33 AC 125 ms
4,524 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
// #include<atcoder/all>
// #include<boost/multiprecision/cpp_int.hpp>

using namespace std;
// using namespace atcoder;
// using bint = boost::multiprecision::cpp_int;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n,m;
  cin >> n >> m;
  vector<P> v(m);
  rep(i,m)cin >> v[i].first >> v[i].second;
  sort(ALL(v));
  int pre = 0;
  int res = 0;
  rep(i,m){
    if(v[i].first <= pre)pre = min(pre,v[i].second);
    else{
      res++;
      pre = v[i].second;
    }
  }
  cout << n-res << "\n";
  

  return 0;
}
0