結果

問題 No.1703 Much Matching
ユーザー mkawa2mkawa2
提出日時 2021-10-08 22:28:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 827 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 161,936 KB
最終ジャッジ日時 2023-09-30 11:03:22
合計ジャッジ時間 26,913 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,412 KB
testcase_01 AC 73 ms
71,156 KB
testcase_02 AC 74 ms
71,204 KB
testcase_03 AC 74 ms
70,828 KB
testcase_04 AC 82 ms
75,488 KB
testcase_05 AC 74 ms
71,160 KB
testcase_06 AC 1,248 ms
122,824 KB
testcase_07 AC 133 ms
79,620 KB
testcase_08 AC 1,300 ms
125,148 KB
testcase_09 AC 1,504 ms
133,004 KB
testcase_10 AC 253 ms
84,548 KB
testcase_11 AC 338 ms
88,740 KB
testcase_12 AC 134 ms
78,884 KB
testcase_13 AC 575 ms
98,356 KB
testcase_14 AC 107 ms
77,784 KB
testcase_15 AC 288 ms
86,756 KB
testcase_16 AC 814 ms
106,896 KB
testcase_17 AC 929 ms
111,428 KB
testcase_18 AC 108 ms
77,564 KB
testcase_19 TLE -
testcase_20 AC 283 ms
86,152 KB
testcase_21 TLE -
testcase_22 AC 887 ms
110,436 KB
testcase_23 AC 662 ms
101,768 KB
testcase_24 AC 104 ms
77,684 KB
testcase_25 AC 152 ms
80,192 KB
testcase_26 AC 447 ms
93,492 KB
testcase_27 AC 1,001 ms
114,596 KB
testcase_28 AC 1,955 ms
147,264 KB
testcase_29 AC 365 ms
89,988 KB
testcase_30 AC 541 ms
96,816 KB
testcase_31 AC 128 ms
79,048 KB
testcase_32 AC 1,025 ms
114,620 KB
testcase_33 AC 666 ms
101,840 KB
testcase_34 AC 136 ms
78,964 KB
testcase_35 AC 220 ms
83,576 KB
testcase_36 TLE -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
md = 10**9+7

class BitMax:
    def __init__(self, n):
        self.inf = 10**9
        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