結果

問題 No.1995 CHIKA Road
ユーザー lilictakalilictaka
提出日時 2022-07-01 22:22:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 84,184 KB
最終ジャッジ日時 2024-05-04 16:43:13
合計ジャッジ時間 7,365 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
51,584 KB
testcase_01 AC 47 ms
51,968 KB
testcase_02 AC 44 ms
52,224 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 42 ms
51,968 KB
testcase_05 AC 44 ms
52,480 KB
testcase_06 AC 85 ms
73,812 KB
testcase_07 AC 122 ms
77,440 KB
testcase_08 AC 46 ms
53,248 KB
testcase_09 AC 45 ms
52,736 KB
testcase_10 AC 216 ms
81,152 KB
testcase_11 AC 266 ms
84,184 KB
testcase_12 AC 158 ms
83,920 KB
testcase_13 AC 129 ms
78,208 KB
testcase_14 AC 134 ms
78,336 KB
testcase_15 AC 227 ms
81,280 KB
testcase_16 AC 97 ms
76,544 KB
testcase_17 AC 176 ms
79,236 KB
testcase_18 AC 244 ms
81,244 KB
testcase_19 AC 246 ms
81,504 KB
testcase_20 AC 164 ms
79,744 KB
testcase_21 AC 157 ms
79,280 KB
testcase_22 AC 231 ms
81,244 KB
testcase_23 AC 122 ms
77,700 KB
testcase_24 AC 216 ms
81,024 KB
testcase_25 AC 105 ms
76,544 KB
testcase_26 AC 129 ms
78,100 KB
testcase_27 AC 212 ms
81,280 KB
testcase_28 AC 153 ms
79,360 KB
testcase_29 AC 237 ms
81,496 KB
testcase_30 AC 102 ms
76,928 KB
testcase_31 AC 86 ms
73,344 KB
testcase_32 AC 110 ms
76,800 KB
testcase_33 AC 219 ms
81,536 KB
testcase_34 AC 85 ms
74,240 KB
testcase_35 AC 127 ms
77,696 KB
testcase_36 AC 136 ms
78,336 KB
testcase_37 AC 237 ms
81,516 KB
testcase_38 AC 180 ms
79,104 KB
testcase_39 AC 84 ms
72,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
board = []
for _ in range(M):
    a,b = map(int,input().split())
    board.append((a,b))
board.sort(key=lambda x:x[1])
cnt = 0
lastr = 0
for l,r in board:
    if lastr <= l:
        cnt += 1
        lastr = r
ans = 2 * (N-1) -cnt
print(ans)
0