結果

問題 No.1995 CHIKA Road
ユーザー nohakai3
提出日時 2022-07-25 16:07:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 496 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 31,616 KB
最終ジャッジ日時 2024-07-07 15:16:40
合計ジャッジ時間 11,834 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
from operator import itemgetter
p=[list(map(int,input().split())) for i in [0]*m]
p.sort(key=itemgetter(1))

now=0
ans=2*(n-1)
for l,r in p:
    if (now>l):
        continue
    now=r
    ans-=1

print(ans)
0