結果

問題 No.1557 Binary Variable
ユーザー prussian_coder
提出日時 2022-01-15 17:58:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 105,100 KB
最終ジャッジ日時 2024-11-21 20:48:21
合計ジャッジ時間 18,739 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[[int(x) for x in input().split()] for _ in range(K)]
A=sorted(A, key=lambda x: x[1])
ans=0
p=0
for i in range(K):
    if A[i][0]>p:
        ans+=1
        p=A[i][1]
print(N-ans)        
0