結果

問題 No.1557 Binary Variable
ユーザー tarattata1tarattata1
提出日時 2021-06-25 22:00:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,399 bytes
コンパイル時間 647 ms
コンパイル使用メモリ 90,968 KB
実行使用メモリ 814,436 KB
最終ジャッジ日時 2023-09-07 14:30:35
合計ジャッジ時間 5,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 29 ms
4,376 KB
testcase_05 AC 30 ms
4,380 KB
testcase_06 AC 31 ms
4,376 KB
testcase_07 AC 30 ms
4,376 KB
testcase_08 AC 30 ms
4,376 KB
testcase_09 AC 32 ms
4,380 KB
testcase_10 AC 34 ms
4,380 KB
testcase_11 AC 33 ms
4,376 KB
testcase_12 AC 32 ms
4,376 KB
testcase_13 AC 35 ms
4,376 KB
testcase_14 AC 41 ms
6,628 KB
testcase_15 AC 36 ms
4,376 KB
testcase_16 AC 42 ms
5,680 KB
testcase_17 AC 41 ms
4,588 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 68 ms
36,616 KB
testcase_20 AC 51 ms
18,260 KB
testcase_21 AC 49 ms
16,828 KB
testcase_22 AC 59 ms
27,996 KB
testcase_23 AC 48 ms
16,172 KB
testcase_24 AC 91 ms
62,724 KB
testcase_25 AC 84 ms
53,748 KB
testcase_26 AC 119 ms
93,580 KB
testcase_27 AC 143 ms
125,704 KB
testcase_28 AC 325 ms
368,260 KB
testcase_29 MLE -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <ctime>
#include <bitset>
#pragma warning(disable:4996) 

//#define ATCODER
#ifdef ATCODER
#include <atcoder/all>
#endif

typedef long long ll;
typedef unsigned long long ull;
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;
#ifdef ATCODER
using namespace atcoder;
#endif


void solve()
{
    int n, m;
    scanf("%d%d", &n, &m);
    vector<int> v(n, INF);
    for (int i = 0; i < m; i++) {
        int l, r;
        scanf("%d%d", &l, &r); l--; r--;
        v[l] = min(v[l], r);
    }
    int ans = 0;
    int las = INF;
    for (int i = 0; i < n; i++) {
        if(v[i]<INF) {
            las = min(las, v[i]);
        }
        if (i == las) {
            ans++;
            las = INF;
        }
    }
    printf("%d\n", n - ans);

    return;
}

int main()
{
#if 1
    solve();
#else
    int T, t;
    scanf("%d", &T);
    for (t = 0; t < T; t++) {
        //printf("Case #%d: ", t + 1);
        solve();
    }
#endif
    return 0;
}
0