結果

問題 No.1703 Much Matching
ユーザー mkawa2mkawa2
提出日時 2021-10-08 22:25:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,303 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 132,364 KB
最終ジャッジ日時 2023-09-30 10:52:51
合計ジャッジ時間 16,902 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,788 KB
testcase_01 AC 17 ms
8,292 KB
testcase_02 AC 16 ms
8,400 KB
testcase_03 AC 17 ms
8,236 KB
testcase_04 AC 17 ms
8,348 KB
testcase_05 AC 17 ms
8,296 KB
testcase_06 AC 1,561 ms
84,288 KB
testcase_07 AC 64 ms
11,936 KB
testcase_08 AC 1,685 ms
90,312 KB
testcase_09 AC 1,922 ms
102,472 KB
testcase_10 AC 206 ms
20,036 KB
testcase_11 AC 333 ms
27,480 KB
testcase_12 AC 62 ms
11,400 KB
testcase_13 AC 646 ms
43,032 KB
testcase_14 AC 29 ms
9,188 KB
testcase_15 AC 268 ms
24,048 KB
testcase_16 AC 942 ms
55,764 KB
testcase_17 AC 1,084 ms
64,044 KB
testcase_18 AC 26 ms
9,072 KB
testcase_19 TLE -
testcase_20 AC 244 ms
22,296 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
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)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**19
# md = 998244353
md = 10**9+7

class BitMax:
    def __init__(self, n):
        self.inf = 10**16
        self.n = n
        self.table = [-self.inf]*(self.n+1)

    def update(self, i, x):
        i += 1
        while i <= self.n:
            if x > self.table[i]: self.table[i] = x
            i += i & -i

    def max(self, i):
        i += 1
        res = -self.inf
        while i > 0:
            if self.table[i] > res: res = self.table[i]
            i -= i & -i
        return res

n, m, q = LI()
ab = LLI(q)
ab.sort(key=lambda x: (x[0], -x[1]))

bit = BitMax(m+5)
bit.update(0, 0)

for a, b in ab:
    pre = bit.max(b-1)
    bit.update(b, pre+1)

print(bit.max(m+4))
0