結果

問題 No.1557 Binary Variable
ユーザー OmameBeansOmameBeans
提出日時 2021-07-06 17:04:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 993 bytes
コンパイル時間 1,745 ms
コンパイル使用メモリ 171,036 KB
実行使用メモリ 4,876 KB
最終ジャッジ日時 2023-09-14 04:25:11
合計ジャッジ時間 10,347 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
4,708 KB
testcase_01 AC 136 ms
4,552 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 103 ms
4,552 KB
testcase_05 AC 102 ms
4,608 KB
testcase_06 AC 96 ms
4,740 KB
testcase_07 AC 98 ms
4,732 KB
testcase_08 AC 111 ms
4,612 KB
testcase_09 AC 113 ms
4,612 KB
testcase_10 AC 121 ms
4,608 KB
testcase_11 AC 123 ms
4,732 KB
testcase_12 AC 111 ms
4,608 KB
testcase_13 AC 122 ms
4,644 KB
testcase_14 AC 131 ms
4,620 KB
testcase_15 AC 123 ms
4,596 KB
testcase_16 AC 129 ms
4,708 KB
testcase_17 AC 129 ms
4,572 KB
testcase_18 AC 129 ms
4,596 KB
testcase_19 AC 141 ms
4,552 KB
testcase_20 AC 140 ms
4,596 KB
testcase_21 AC 140 ms
4,604 KB
testcase_22 AC 142 ms
4,548 KB
testcase_23 AC 139 ms
4,604 KB
testcase_24 AC 145 ms
4,748 KB
testcase_25 AC 149 ms
4,628 KB
testcase_26 AC 148 ms
4,668 KB
testcase_27 AC 150 ms
4,600 KB
testcase_28 AC 152 ms
4,736 KB
testcase_29 AC 161 ms
4,620 KB
testcase_30 AC 157 ms
4,564 KB
testcase_31 AC 161 ms
4,664 KB
testcase_32 AC 161 ms
4,652 KB
testcase_33 AC 139 ms
4,876 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define DREP(i,s,n) for(int i = (s); i < (n); i++)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);
ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}

int main() {
    int N,M; cin >> N >> M;
    vector<P> res(M);
    REP(i,M) cin >> res[i].second >> res[i].first;
    sort(res.begin(),res.end());
    int l = 0;
    for(auto e : res) {
        if(l < e.second) N--, l = e.first;
    }
    cout << N << endl;
    return 0;
}
0