結果

問題 No.1557 Binary Variable
ユーザー mamimume____momamimume____mo
提出日時 2021-07-26 13:06:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 1,507 ms
コンパイル使用メモリ 172,560 KB
実行使用メモリ 5,260 KB
最終ジャッジ日時 2023-09-29 08:14:38
合計ジャッジ時間 8,261 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
5,056 KB
testcase_01 AC 133 ms
5,164 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 104 ms
5,248 KB
testcase_05 AC 104 ms
5,056 KB
testcase_06 AC 98 ms
5,220 KB
testcase_07 AC 101 ms
5,164 KB
testcase_08 AC 113 ms
5,168 KB
testcase_09 AC 114 ms
5,092 KB
testcase_10 AC 126 ms
5,116 KB
testcase_11 AC 124 ms
5,044 KB
testcase_12 AC 112 ms
5,040 KB
testcase_13 AC 125 ms
5,096 KB
testcase_14 AC 135 ms
5,104 KB
testcase_15 AC 127 ms
5,168 KB
testcase_16 AC 135 ms
5,096 KB
testcase_17 AC 134 ms
5,228 KB
testcase_18 AC 133 ms
5,132 KB
testcase_19 AC 144 ms
5,260 KB
testcase_20 AC 144 ms
5,096 KB
testcase_21 AC 143 ms
5,060 KB
testcase_22 AC 144 ms
5,224 KB
testcase_23 AC 143 ms
5,224 KB
testcase_24 AC 149 ms
5,096 KB
testcase_25 AC 148 ms
5,168 KB
testcase_26 AC 153 ms
5,044 KB
testcase_27 AC 153 ms
5,096 KB
testcase_28 AC 155 ms
5,060 KB
testcase_29 AC 164 ms
5,112 KB
testcase_30 AC 161 ms
5,040 KB
testcase_31 AC 166 ms
5,216 KB
testcase_32 AC 161 ms
5,092 KB
testcase_33 AC 142 ms
5,224 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll INFL = 2e18;
template <class T>bool chmin(T &a, T b){ if (a > b) { a = b; return true;} else return false;}
template <class T>bool chmax(T &a, T b){ if (a < b) { a = b; return true;} else return false;}

int main() {
    int N,M;
    cin >> N >> M;

    vector<pair<int,int>> RL;
    for (int i = 0;i < M;i++) {
        int L,R;
        cin >> L >> R;
        RL.push_back({R,L});
    }

    sort(RL.begin(), RL.end());

    int cnt = 0;
    for (int i = 0;i < M;i++) {
        int j = i;
        while (j < M && RL[i].first >= RL[j].second) {
            j++;
        }
        cnt++;
        i = j-1;
    }

    cout << N - cnt << endl;
}
0