結果

問題 No.1557 Binary Variable
ユーザー tarattata1tarattata1
提出日時 2021-06-25 21:47:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,456 bytes
コンパイル時間 782 ms
コンパイル使用メモリ 94,400 KB
実行使用メモリ 814,552 KB
最終ジャッジ日時 2023-09-07 14:26:16
合計ジャッジ時間 8,413 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 34 ms
4,688 KB
testcase_05 AC 34 ms
4,776 KB
testcase_06 AC 33 ms
4,740 KB
testcase_07 AC 34 ms
4,772 KB
testcase_08 AC 39 ms
4,752 KB
testcase_09 AC 38 ms
4,828 KB
testcase_10 AC 46 ms
5,560 KB
testcase_11 AC 47 ms
5,740 KB
testcase_12 AC 38 ms
4,832 KB
testcase_13 AC 48 ms
5,816 KB
testcase_14 AC 73 ms
30,744 KB
testcase_15 AC 49 ms
5,904 KB
testcase_16 AC 69 ms
23,644 KB
testcase_17 AC 63 ms
15,048 KB
testcase_18 AC 60 ms
12,028 KB
testcase_19 AC 188 ms
210,604 KB
testcase_20 AC 120 ms
100,248 KB
testcase_21 AC 118 ms
92,740 KB
testcase_22 AC 155 ms
158,796 KB
testcase_23 AC 114 ms
87,592 KB
testcase_24 AC 323 ms
367,220 KB
testcase_25 AC 242 ms
312,340 KB
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 -- -
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<vector<int> > v(n);
    for (int i = 0; i < m; i++) {
        int l, r;
        scanf("%d%d", &l, &r); l--; r--;
        v[l].push_back(r);
    }
    int ans = 0;
    int las = INF;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < (int)v[i].size(); j++) {
            int t = v[i][j];
            las = min(las, t);
        }
        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