結果

問題 No.1995 CHIKA Road
ユーザー mkawa2mkawa2
提出日時 2022-07-01 21:45:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 873 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 90,532 KB
最終ジャッジ日時 2023-08-17 09:14:39
合計ジャッジ時間 8,462 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,508 KB
testcase_01 AC 75 ms
71,456 KB
testcase_02 AC 75 ms
71,284 KB
testcase_03 AC 75 ms
71,416 KB
testcase_04 AC 75 ms
71,448 KB
testcase_05 AC 77 ms
71,480 KB
testcase_06 AC 104 ms
78,368 KB
testcase_07 AC 128 ms
78,344 KB
testcase_08 AC 75 ms
71,228 KB
testcase_09 AC 75 ms
71,464 KB
testcase_10 AC 224 ms
87,756 KB
testcase_11 AC 250 ms
87,512 KB
testcase_12 AC 157 ms
86,876 KB
testcase_13 AC 138 ms
80,460 KB
testcase_14 AC 143 ms
80,388 KB
testcase_15 AC 250 ms
90,532 KB
testcase_16 AC 112 ms
78,224 KB
testcase_17 AC 178 ms
83,064 KB
testcase_18 AC 248 ms
88,020 KB
testcase_19 AC 246 ms
87,964 KB
testcase_20 AC 173 ms
82,876 KB
testcase_21 AC 171 ms
84,624 KB
testcase_22 AC 241 ms
87,592 KB
testcase_23 AC 136 ms
81,196 KB
testcase_24 AC 220 ms
85,660 KB
testcase_25 AC 114 ms
78,268 KB
testcase_26 AC 139 ms
80,364 KB
testcase_27 AC 214 ms
85,736 KB
testcase_28 AC 171 ms
82,632 KB
testcase_29 AC 243 ms
87,956 KB
testcase_30 AC 111 ms
78,348 KB
testcase_31 AC 94 ms
76,612 KB
testcase_32 AC 116 ms
78,420 KB
testcase_33 AC 210 ms
85,564 KB
testcase_34 AC 102 ms
78,592 KB
testcase_35 AC 136 ms
80,276 KB
testcase_36 AC 142 ms
80,752 KB
testcase_37 AC 257 ms
89,376 KB
testcase_38 AC 192 ms
82,980 KB
testcase_39 AC 93 ms
76,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = (1 << 63)-1
inf = (1 << 31)-1
# md = 10**9+7
md = 998244353

n, m = LI()
ab = LLI1(m)
ab.sort(key=lambda x: x[1])

r = -1
ans = (n-1)*2
for a, b in ab:
    if a >= r:
        ans -= 1
        r = b

print(ans)
0