結果

問題 No.1557 Binary Variable
ユーザー abc3abc3
提出日時 2021-06-25 23:24:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 1,009 bytes
コンパイル時間 2,399 ms
コンパイル使用メモリ 205,048 KB
実行使用メモリ 6,288 KB
最終ジャッジ日時 2023-09-07 15:03:20
合計ジャッジ時間 6,595 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
6,244 KB
testcase_01 AC 49 ms
6,208 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 51 ms
6,184 KB
testcase_05 AC 53 ms
6,184 KB
testcase_06 AC 50 ms
6,116 KB
testcase_07 AC 51 ms
6,184 KB
testcase_08 AC 56 ms
6,072 KB
testcase_09 AC 57 ms
6,140 KB
testcase_10 AC 59 ms
6,128 KB
testcase_11 AC 59 ms
6,072 KB
testcase_12 AC 56 ms
6,184 KB
testcase_13 AC 59 ms
6,108 KB
testcase_14 AC 60 ms
6,124 KB
testcase_15 AC 58 ms
6,156 KB
testcase_16 AC 59 ms
6,100 KB
testcase_17 AC 60 ms
6,248 KB
testcase_18 AC 59 ms
6,096 KB
testcase_19 AC 62 ms
6,068 KB
testcase_20 AC 63 ms
6,140 KB
testcase_21 AC 63 ms
6,172 KB
testcase_22 AC 63 ms
6,192 KB
testcase_23 AC 62 ms
6,144 KB
testcase_24 AC 65 ms
6,192 KB
testcase_25 AC 64 ms
6,288 KB
testcase_26 AC 65 ms
6,224 KB
testcase_27 AC 64 ms
6,076 KB
testcase_28 AC 66 ms
6,140 KB
testcase_29 AC 68 ms
6,212 KB
testcase_30 AC 67 ms
6,100 KB
testcase_31 AC 69 ms
6,120 KB
testcase_32 AC 68 ms
6,148 KB
testcase_33 AC 61 ms
6,112 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<ll,ll>;
    const int INF=INT_MAX;
    const int mod=1e9+7;
    
    void solve(){
        int n,m;
        cin>>n>>m;
        vector<P>t(m);
        rep(i,m){
            cin>>t[i].second>>t[i].first;
        }
        sort(t.begin(),t.end());
        int ans=n,pre=0;
        rep(i,m){
          if(t[i].second<=pre){continue;}
          ans--;
          pre=t[i].first;
        }
        cout<<ans<<endl;
    }

    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        solve();
        
        return 0;
    }
0