結果

問題 No.1995 CHIKA Road
ユーザー sotanishysotanishy
提出日時 2022-07-01 22:11:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 82,176 KB
最終ジャッジ日時 2024-05-04 16:33:39
合計ジャッジ時間 5,279 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,224 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 41 ms
51,712 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 37 ms
51,968 KB
testcase_05 AC 34 ms
52,096 KB
testcase_06 AC 57 ms
66,048 KB
testcase_07 AC 84 ms
77,824 KB
testcase_08 AC 38 ms
52,352 KB
testcase_09 AC 37 ms
52,096 KB
testcase_10 AC 139 ms
81,920 KB
testcase_11 AC 162 ms
81,408 KB
testcase_12 AC 82 ms
80,384 KB
testcase_13 AC 80 ms
77,468 KB
testcase_14 AC 82 ms
77,192 KB
testcase_15 AC 150 ms
81,280 KB
testcase_16 AC 59 ms
68,992 KB
testcase_17 AC 116 ms
79,232 KB
testcase_18 AC 165 ms
81,536 KB
testcase_19 AC 167 ms
81,332 KB
testcase_20 AC 107 ms
78,848 KB
testcase_21 AC 101 ms
78,464 KB
testcase_22 AC 162 ms
81,408 KB
testcase_23 AC 78 ms
77,440 KB
testcase_24 AC 140 ms
81,352 KB
testcase_25 AC 63 ms
71,168 KB
testcase_26 AC 81 ms
77,440 KB
testcase_27 AC 140 ms
81,152 KB
testcase_28 AC 96 ms
78,556 KB
testcase_29 AC 164 ms
81,024 KB
testcase_30 AC 61 ms
70,528 KB
testcase_31 AC 51 ms
65,024 KB
testcase_32 AC 66 ms
73,216 KB
testcase_33 AC 143 ms
82,176 KB
testcase_34 AC 53 ms
65,920 KB
testcase_35 AC 81 ms
77,620 KB
testcase_36 AC 90 ms
77,312 KB
testcase_37 AC 155 ms
81,580 KB
testcase_38 AC 118 ms
79,232 KB
testcase_39 AC 50 ms
65,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
intervals = []
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    intervals.append((A, B))
intervals.sort(key=lambda p: p[1])
ans = 2*(N-1)
ma = -1
for l, r in intervals:
    if ma <= l:
        ans -= 1
        ma = r
print(ans)

0