結果

問題 No.1995 CHIKA Road
ユーザー tamatotamato
提出日時 2022-07-01 21:32:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 82,344 KB
最終ジャッジ日時 2024-05-04 15:42:44
合計ジャッジ時間 4,857 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
52,096 KB
testcase_01 AC 33 ms
51,584 KB
testcase_02 AC 32 ms
51,968 KB
testcase_03 AC 34 ms
51,584 KB
testcase_04 AC 33 ms
51,584 KB
testcase_05 AC 33 ms
51,840 KB
testcase_06 AC 47 ms
65,280 KB
testcase_07 AC 76 ms
77,184 KB
testcase_08 AC 34 ms
52,396 KB
testcase_09 AC 34 ms
52,336 KB
testcase_10 AC 137 ms
82,252 KB
testcase_11 AC 161 ms
81,152 KB
testcase_12 AC 82 ms
81,152 KB
testcase_13 AC 79 ms
77,264 KB
testcase_14 AC 80 ms
76,928 KB
testcase_15 AC 146 ms
81,152 KB
testcase_16 AC 56 ms
68,480 KB
testcase_17 AC 108 ms
79,232 KB
testcase_18 AC 153 ms
81,152 KB
testcase_19 AC 156 ms
81,424 KB
testcase_20 AC 109 ms
79,004 KB
testcase_21 AC 99 ms
78,848 KB
testcase_22 AC 147 ms
81,444 KB
testcase_23 AC 75 ms
77,568 KB
testcase_24 AC 144 ms
81,664 KB
testcase_25 AC 58 ms
71,168 KB
testcase_26 AC 78 ms
77,056 KB
testcase_27 AC 134 ms
81,024 KB
testcase_28 AC 100 ms
78,132 KB
testcase_29 AC 151 ms
81,152 KB
testcase_30 AC 58 ms
69,632 KB
testcase_31 AC 49 ms
65,280 KB
testcase_32 AC 60 ms
73,344 KB
testcase_33 AC 149 ms
82,344 KB
testcase_34 AC 51 ms
65,152 KB
testcase_35 AC 78 ms
77,440 KB
testcase_36 AC 85 ms
77,596 KB
testcase_37 AC 147 ms
81,792 KB
testcase_38 AC 113 ms
79,668 KB
testcase_39 AC 48 ms
65,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())
    AB = []
    for _ in range(M):
        a, b = map(int, input().split())
        AB.append((a, b))
    AB.sort(key=lambda x: x[1])
    ans = 2 * (N - 1)
    r = 0
    for a, b in AB:
        if a < r:
            continue
        ans -= 1
        r = b
    print(ans)


if __name__ == '__main__':
    main()
0