結果
問題 | No.1703 Much Matching |
ユーザー | mkawa2 |
提出日時 | 2021-10-08 22:23:42 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,288 bytes |
コンパイル時間 | 1,106 ms |
コンパイル使用メモリ | 87,076 KB |
実行使用メモリ | 162,004 KB |
最終ジャッジ日時 | 2023-09-30 10:50:04 |
合計ジャッジ時間 | 28,364 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
71,428 KB |
testcase_01 | AC | 75 ms
71,164 KB |
testcase_02 | AC | 73 ms
71,008 KB |
testcase_03 | AC | 74 ms
71,252 KB |
testcase_04 | AC | 84 ms
75,684 KB |
testcase_05 | AC | 74 ms
71,120 KB |
testcase_06 | AC | 1,255 ms
122,936 KB |
testcase_07 | AC | 134 ms
79,880 KB |
testcase_08 | AC | 1,287 ms
125,232 KB |
testcase_09 | AC | 1,500 ms
133,052 KB |
testcase_10 | AC | 251 ms
84,976 KB |
testcase_11 | AC | 337 ms
88,728 KB |
testcase_12 | AC | 139 ms
79,164 KB |
testcase_13 | AC | 568 ms
98,640 KB |
testcase_14 | AC | 110 ms
78,020 KB |
testcase_15 | AC | 287 ms
87,152 KB |
testcase_16 | AC | 802 ms
107,072 KB |
testcase_17 | AC | 907 ms
111,652 KB |
testcase_18 | AC | 107 ms
77,992 KB |
testcase_19 | AC | 1,989 ms
150,856 KB |
testcase_20 | AC | 277 ms
86,288 KB |
testcase_21 | TLE | - |
testcase_22 | AC | 866 ms
110,504 KB |
testcase_23 | AC | 652 ms
102,016 KB |
testcase_24 | AC | 104 ms
77,764 KB |
testcase_25 | AC | 150 ms
80,324 KB |
testcase_26 | AC | 439 ms
93,516 KB |
testcase_27 | AC | 983 ms
114,648 KB |
testcase_28 | AC | 1,889 ms
147,428 KB |
testcase_29 | AC | 363 ms
90,112 KB |
testcase_30 | AC | 525 ms
96,724 KB |
testcase_31 | AC | 130 ms
78,996 KB |
testcase_32 | AC | 1,015 ms
114,804 KB |
testcase_33 | AC | 661 ms
102,432 KB |
testcase_34 | AC | 134 ms
78,748 KB |
testcase_35 | AC | 220 ms
83,736 KB |
testcase_36 | TLE | - |
testcase_37 | -- | - |
ソースコード
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))