結果

問題 No.1557 Binary Variable
ユーザー rlangevin
提出日時 2023-01-09 16:27:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 340 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 86,816 KB
最終ジャッジ日時 2024-12-17 19:39:43
合計ジャッジ時間 9,211 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline

N, M = map(int, readline().split())
D = []
for i in range(M):
    L, R = map(int, readline().split())
    D.append((L, R))
D.sort(reverse=True)

ans = N
pre = 10 ** 18
for i in range(M):
    L, R = D[i]
    if R >= pre:
        continue
    else:
        ans -= 1
        pre = L
print(ans)        
0