結果

問題 No.1557 Binary Variable
ユーザー yakkiyakki
提出日時 2021-06-25 21:33:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 1,123 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 123,748 KB
実行使用メモリ 4,888 KB
最終ジャッジ日時 2023-09-07 14:16:14
合計ジャッジ時間 7,925 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
4,616 KB
testcase_01 AC 134 ms
4,752 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 103 ms
4,616 KB
testcase_05 AC 102 ms
4,576 KB
testcase_06 AC 96 ms
4,592 KB
testcase_07 AC 99 ms
4,680 KB
testcase_08 AC 111 ms
4,628 KB
testcase_09 AC 113 ms
4,568 KB
testcase_10 AC 122 ms
4,572 KB
testcase_11 AC 123 ms
4,888 KB
testcase_12 AC 111 ms
4,616 KB
testcase_13 AC 123 ms
4,688 KB
testcase_14 AC 131 ms
4,592 KB
testcase_15 AC 122 ms
4,584 KB
testcase_16 AC 130 ms
4,572 KB
testcase_17 AC 129 ms
4,680 KB
testcase_18 AC 128 ms
4,760 KB
testcase_19 AC 141 ms
4,876 KB
testcase_20 AC 140 ms
4,620 KB
testcase_21 AC 139 ms
4,676 KB
testcase_22 AC 141 ms
4,736 KB
testcase_23 AC 139 ms
4,792 KB
testcase_24 AC 146 ms
4,872 KB
testcase_25 AC 144 ms
4,616 KB
testcase_26 AC 148 ms
4,632 KB
testcase_27 AC 149 ms
4,568 KB
testcase_28 AC 152 ms
4,764 KB
testcase_29 AC 161 ms
4,616 KB
testcase_30 AC 158 ms
4,580 KB
testcase_31 AC 163 ms
4,756 KB
testcase_32 AC 158 ms
4,588 KB
testcase_33 AC 139 ms
4,736 KB
testcase_34 AC 1 ms
4,384 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0)

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;
//using mint = modint998244353;

int dh[] = {-1,0,1,0};
int dw[] = {0,1,0,-1};


int main(){
    int n,m; cin >> n >> m;
    int ans = n;
    int now = 0;
    vector<Pi> rl(m);
    rep(i,m){
        cin >> rl[i].second >> rl[i].first;
    }
    sort(rl.begin(),rl.end());
    rep(i,m){
        if(now < rl[i].second){
            ans--;
            now = rl[i].first;
        }
    }
    cout << ans << endl;
}

0