結果

問題 No.1995 CHIKA Road
ユーザー MasKoaTSMasKoaTS
提出日時 2022-06-14 21:37:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 890 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 103,268 KB
最終ジャッジ日時 2024-04-14 03:11:39
合計ジャッジ時間 10,870 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
86,836 KB
testcase_01 AC 145 ms
86,908 KB
testcase_02 AC 151 ms
86,928 KB
testcase_03 AC 149 ms
86,808 KB
testcase_04 AC 146 ms
86,964 KB
testcase_05 AC 148 ms
86,524 KB
testcase_06 AC 183 ms
89,824 KB
testcase_07 AC 210 ms
91,684 KB
testcase_08 AC 144 ms
86,940 KB
testcase_09 AC 152 ms
86,848 KB
testcase_10 AC 334 ms
99,940 KB
testcase_11 AC 318 ms
101,320 KB
testcase_12 AC 213 ms
101,588 KB
testcase_13 AC 191 ms
91,636 KB
testcase_14 AC 189 ms
91,644 KB
testcase_15 AC 286 ms
99,648 KB
testcase_16 AC 156 ms
89,852 KB
testcase_17 AC 233 ms
95,068 KB
testcase_18 AC 312 ms
99,916 KB
testcase_19 AC 304 ms
100,032 KB
testcase_20 AC 226 ms
94,284 KB
testcase_21 AC 214 ms
94,288 KB
testcase_22 AC 304 ms
99,648 KB
testcase_23 AC 185 ms
91,964 KB
testcase_24 AC 300 ms
103,268 KB
testcase_25 AC 162 ms
89,956 KB
testcase_26 AC 188 ms
92,040 KB
testcase_27 AC 266 ms
97,348 KB
testcase_28 AC 217 ms
94,052 KB
testcase_29 AC 301 ms
99,784 KB
testcase_30 AC 164 ms
89,480 KB
testcase_31 AC 150 ms
89,680 KB
testcase_32 AC 172 ms
91,524 KB
testcase_33 AC 278 ms
97,824 KB
testcase_34 AC 155 ms
89,672 KB
testcase_35 AC 185 ms
91,708 KB
testcase_36 AC 194 ms
92,168 KB
testcase_37 AC 307 ms
99,700 KB
testcase_38 AC 249 ms
97,508 KB
testcase_39 AC 151 ms
89,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = sys.stdin.readline
input = lambda : inp().rstrip()
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda :list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];	dy = [0, 1, 0, -1]


"""
Main Code
"""

n, m = getNs()
plan = sorted([getList() for _ in [0] * m], key = lambda x : x[1])

now = 0
ans = 2 * (n - 1)
for l, r in plan:
	if(now > l):
		continue
	now = r
	ans -= 1
print(ans)
0