結果

問題 No.1995 CHIKA Road
ユーザー ikomaikoma
提出日時 2022-07-01 22:19:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 90,976 KB
最終ジャッジ日時 2024-05-04 16:42:03
合計ジャッジ時間 5,213 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,592 KB
testcase_01 AC 36 ms
52,568 KB
testcase_02 AC 33 ms
52,996 KB
testcase_03 AC 31 ms
52,212 KB
testcase_04 AC 32 ms
52,372 KB
testcase_05 AC 32 ms
52,640 KB
testcase_06 AC 49 ms
72,276 KB
testcase_07 AC 81 ms
77,404 KB
testcase_08 AC 36 ms
53,608 KB
testcase_09 AC 36 ms
53,572 KB
testcase_10 AC 153 ms
85,300 KB
testcase_11 AC 174 ms
87,368 KB
testcase_12 AC 97 ms
86,588 KB
testcase_13 AC 91 ms
80,760 KB
testcase_14 AC 89 ms
80,116 KB
testcase_15 AC 153 ms
84,788 KB
testcase_16 AC 69 ms
77,400 KB
testcase_17 AC 118 ms
82,276 KB
testcase_18 AC 189 ms
90,976 KB
testcase_19 AC 183 ms
90,428 KB
testcase_20 AC 115 ms
81,764 KB
testcase_21 AC 103 ms
79,940 KB
testcase_22 AC 164 ms
85,584 KB
testcase_23 AC 77 ms
77,900 KB
testcase_24 AC 146 ms
84,900 KB
testcase_25 AC 66 ms
77,264 KB
testcase_26 AC 86 ms
79,496 KB
testcase_27 AC 148 ms
85,156 KB
testcase_28 AC 102 ms
79,832 KB
testcase_29 AC 161 ms
85,180 KB
testcase_30 AC 63 ms
77,464 KB
testcase_31 AC 50 ms
71,132 KB
testcase_32 AC 72 ms
77,292 KB
testcase_33 AC 155 ms
87,852 KB
testcase_34 AC 51 ms
71,864 KB
testcase_35 AC 80 ms
77,388 KB
testcase_36 AC 88 ms
79,832 KB
testcase_37 AC 161 ms
85,032 KB
testcase_38 AC 121 ms
82,316 KB
testcase_39 AC 50 ms
70,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(M)]
AB.sort(key=lambda x:x[1])
end=0
ans=(N-1)*2
for a,b in AB:
    if end<=a:
        end=b
        ans-=1
print(ans)
0