結果

問題 No.1557 Binary Variable
ユーザー tnakao0123tnakao0123
提出日時 2021-06-27 23:54:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 898 bytes
コンパイル時間 895 ms
コンパイル使用メモリ 95,168 KB
実行使用メモリ 5,356 KB
最終ジャッジ日時 2023-09-07 18:09:48
合計ジャッジ時間 4,828 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
5,188 KB
testcase_01 AC 49 ms
5,080 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 52 ms
5,036 KB
testcase_05 AC 52 ms
5,356 KB
testcase_06 AC 51 ms
5,096 KB
testcase_07 AC 51 ms
5,084 KB
testcase_08 AC 55 ms
5,080 KB
testcase_09 AC 55 ms
5,228 KB
testcase_10 AC 58 ms
5,040 KB
testcase_11 AC 58 ms
5,036 KB
testcase_12 AC 55 ms
5,128 KB
testcase_13 AC 58 ms
5,092 KB
testcase_14 AC 58 ms
5,092 KB
testcase_15 AC 58 ms
5,056 KB
testcase_16 AC 59 ms
5,136 KB
testcase_17 AC 58 ms
5,032 KB
testcase_18 AC 59 ms
5,140 KB
testcase_19 AC 61 ms
5,144 KB
testcase_20 AC 60 ms
5,156 KB
testcase_21 AC 60 ms
5,112 KB
testcase_22 AC 60 ms
5,132 KB
testcase_23 AC 61 ms
5,180 KB
testcase_24 AC 62 ms
5,264 KB
testcase_25 AC 62 ms
5,344 KB
testcase_26 AC 62 ms
5,132 KB
testcase_27 AC 63 ms
5,064 KB
testcase_28 AC 63 ms
5,180 KB
testcase_29 AC 65 ms
5,128 KB
testcase_30 AC 64 ms
5,060 KB
testcase_31 AC 65 ms
5,112 KB
testcase_32 AC 65 ms
5,128 KB
testcase_33 AC 61 ms
5,144 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1557.cc:  No.1557 Binary Variable - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 200000;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

pii lrs[MAX_M];

/* subroutines */

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < m; i++)
    scanf("%d%d", &lrs[i].second, &lrs[i].first);
  sort(lrs, lrs + m);

  int c = 0, x = 0;
  for (int i = 0; i < m; i++) {
    int li = lrs[i].second, ri = lrs[i].first;
    if (x < li) c++, x = ri;
  }

  printf("%d\n", n - c);
  return 0;
}
0