結果

問題 No.1557 Binary Variable
ユーザー c-yan
提出日時 2021-06-26 00:29:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 598 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 54,532 KB
最終ジャッジ日時 2024-06-25 09:02:20
合計ジャッジ時間 20,789 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

readline = stdin.readline

N, M = map(int, readline().split())
LR = [list(map(int, readline().split())) for _ in range(M)]

result = N
t = -1
for L, R in sorted(LR, key=lambda x: x[1]):
    if L <= t <= R:
        continue
    result -= 1
    t = R
print(result)
0