結果

問題 No.1995 CHIKA Road
コンテスト
ユーザー aaaaaaaaaa2230
提出日時 2022-07-01 21:57:40
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 159 ms / 2,000 ms
+ 648µs
コード長 214 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 64 ms
コンパイル使用メモリ 81,668 KB
実行使用メモリ 96,732 KB
最終ジャッジ日時 2026-09-30 04:52:20
合計ジャッジ時間 6,286 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(m)]
ans = 0
AB.sort(key=lambda x: x[1])
now = 0
for a,b in AB:
    if now <= a:
        now = b
        ans += 1
print(2*(n-1)-ans)
0