結果

問題 No.1557 Binary Variable
ユーザー HaaHaa
提出日時 2021-06-25 21:31:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 786 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 171,108 KB
実行使用メモリ 6,348 KB
最終ジャッジ日時 2023-09-07 14:11:29
合計ジャッジ時間 7,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
6,132 KB
testcase_01 AC 139 ms
6,216 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 91 ms
6,144 KB
testcase_05 AC 90 ms
6,136 KB
testcase_06 AC 84 ms
6,100 KB
testcase_07 AC 87 ms
6,052 KB
testcase_08 AC 100 ms
6,200 KB
testcase_09 AC 100 ms
6,056 KB
testcase_10 AC 108 ms
6,280 KB
testcase_11 AC 111 ms
6,104 KB
testcase_12 AC 98 ms
6,096 KB
testcase_13 AC 110 ms
6,096 KB
testcase_14 AC 123 ms
6,280 KB
testcase_15 AC 110 ms
6,228 KB
testcase_16 AC 122 ms
6,160 KB
testcase_17 AC 119 ms
6,148 KB
testcase_18 AC 119 ms
6,160 KB
testcase_19 AC 132 ms
6,148 KB
testcase_20 AC 130 ms
6,216 KB
testcase_21 AC 131 ms
6,192 KB
testcase_22 AC 132 ms
6,104 KB
testcase_23 AC 130 ms
6,128 KB
testcase_24 AC 137 ms
6,128 KB
testcase_25 AC 138 ms
6,048 KB
testcase_26 AC 141 ms
6,348 KB
testcase_27 AC 142 ms
6,188 KB
testcase_28 AC 144 ms
6,180 KB
testcase_29 AC 155 ms
6,200 KB
testcase_30 AC 150 ms
6,152 KB
testcase_31 AC 153 ms
6,152 KB
testcase_32 AC 150 ms
6,168 KB
testcase_33 AC 129 ms
6,200 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main(){
    ll n, m; cin >> n >> m;
    vector<P> p(m);
    REP(i,m) cin >> p[i].first >> p[i].second;
    sort(ALL(p));
    ll ans=n;
    ll r=-1;
    REP(i,m){
        if(r<p[i].first){
            ans--;
            r=p[i].second;
        }
        else{
            chmin(r,p[i].second);
        }
    }
    cout << ans << endl;
    return 0;
}
0