結果

問題 No.1557 Binary Variable
ユーザー noya2noya2
提出日時 2021-04-18 13:51:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 593 bytes
コンパイル時間 3,857 ms
コンパイル使用メモリ 262,752 KB
実行使用メモリ 4,952 KB
最終ジャッジ日時 2023-09-07 13:54:34
合計ジャッジ時間 12,542 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
4,620 KB
testcase_01 AC 126 ms
4,684 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 100 ms
4,804 KB
testcase_05 AC 96 ms
4,680 KB
testcase_06 AC 92 ms
4,688 KB
testcase_07 AC 89 ms
4,676 KB
testcase_08 AC 104 ms
4,692 KB
testcase_09 AC 106 ms
4,664 KB
testcase_10 AC 112 ms
4,952 KB
testcase_11 AC 114 ms
4,656 KB
testcase_12 AC 106 ms
4,628 KB
testcase_13 AC 123 ms
4,660 KB
testcase_14 AC 122 ms
4,628 KB
testcase_15 AC 118 ms
4,656 KB
testcase_16 AC 124 ms
4,812 KB
testcase_17 AC 120 ms
4,800 KB
testcase_18 AC 116 ms
4,764 KB
testcase_19 AC 133 ms
4,804 KB
testcase_20 AC 129 ms
4,684 KB
testcase_21 AC 129 ms
4,748 KB
testcase_22 AC 129 ms
4,808 KB
testcase_23 AC 131 ms
4,748 KB
testcase_24 AC 137 ms
4,736 KB
testcase_25 AC 136 ms
4,768 KB
testcase_26 AC 141 ms
4,612 KB
testcase_27 AC 139 ms
4,660 KB
testcase_28 AC 145 ms
4,764 KB
testcase_29 AC 153 ms
4,812 KB
testcase_30 AC 149 ms
4,804 KB
testcase_31 AC 160 ms
4,692 KB
testcase_32 AC 147 ms
4,632 KB
testcase_33 AC 131 ms
4,676 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
testcase_36 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using namespace atcoder;
using namespace internal;
using P = pair<int, int>;

template <typename SD>
void sor(vector<SD> &ar){sort(ar.begin(),ar.end());}

int main(){
    int n, m; cin >> n >> m;
    int ans = n;
    vector<P> ar(m);
    rep(i,m){
        int l, r; cin >> l >> r;
        ar[i] = P(r,l-1);
    }
    sor(ar);
    int t = 0;
    rep(i,m){
        if (t <= ar[i].second){
            ans--;
            t = ar[i].first;
        }
    }
    cout << ans << endl;
}
0