結果

問題 No.1995 CHIKA Road
ユーザー terasaterasa
提出日時 2022-07-02 13:04:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 992 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 89,936 KB
最終ジャッジ日時 2023-08-18 03:58:33
合計ジャッジ時間 11,975 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,572 KB
testcase_01 AC 90 ms
71,448 KB
testcase_02 AC 91 ms
71,716 KB
testcase_03 AC 90 ms
71,664 KB
testcase_04 AC 91 ms
71,784 KB
testcase_05 AC 91 ms
71,584 KB
testcase_06 AC 113 ms
77,452 KB
testcase_07 AC 149 ms
80,960 KB
testcase_08 AC 92 ms
71,720 KB
testcase_09 AC 95 ms
71,680 KB
testcase_10 AC 258 ms
88,840 KB
testcase_11 AC 280 ms
89,936 KB
testcase_12 AC 179 ms
87,880 KB
testcase_13 AC 160 ms
80,992 KB
testcase_14 AC 165 ms
81,196 KB
testcase_15 AC 258 ms
88,188 KB
testcase_16 AC 121 ms
79,308 KB
testcase_17 AC 205 ms
84,956 KB
testcase_18 AC 300 ms
88,912 KB
testcase_19 AC 294 ms
89,236 KB
testcase_20 AC 208 ms
83,264 KB
testcase_21 AC 186 ms
83,100 KB
testcase_22 AC 277 ms
88,692 KB
testcase_23 AC 148 ms
81,316 KB
testcase_24 AC 259 ms
87,440 KB
testcase_25 AC 131 ms
79,692 KB
testcase_26 AC 158 ms
81,336 KB
testcase_27 AC 251 ms
87,112 KB
testcase_28 AC 187 ms
83,104 KB
testcase_29 AC 287 ms
89,056 KB
testcase_30 AC 128 ms
79,316 KB
testcase_31 AC 112 ms
77,444 KB
testcase_32 AC 137 ms
79,612 KB
testcase_33 AC 254 ms
86,800 KB
testcase_34 AC 113 ms
77,920 KB
testcase_35 AC 154 ms
81,472 KB
testcase_36 AC 168 ms
81,732 KB
testcase_37 AC 269 ms
88,904 KB
testcase_38 AC 211 ms
84,856 KB
testcase_39 AC 111 ms
77,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N, M = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(M)]
A.sort(key=lambda x: x[1])

cnt = 0
last = 0
for a, b in A:
    if last > a:
        continue
    last = b
    cnt += 1
print(2 * (N - 1) - cnt)
0