結果
問題 |
No.1703 Much Matching
|
ユーザー |
![]() |
提出日時 | 2021-10-08 22:59:22 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 598 bytes |
コンパイル時間 | 488 ms |
コンパイル使用メモリ | 82,184 KB |
実行使用メモリ | 209,716 KB |
最終ジャッジ日時 | 2024-07-23 06:13:55 |
合計ジャッジ時間 | 18,258 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 WA * 12 TLE * 4 -- * 18 |
ソースコード
n,m,q = map(int,input().split()) l1,l2 = [],[] for _ in range(q): a,b = map(int,input().split()) l1.append((a,b)) l2.append((b,a)) import bisect def lis(l): l.sort(key = lambda x:(x[0],x[1])) flg = 0 ll = [] for i in range(q): if l[i][0] != flg: ll.append(l[i][1]) nn = len(ll) dp = [] for i in range(nn): idx = bisect.bisect(dp,ll[i]) # print(i,ll[i],idx,dp) if idx == len(dp): dp.append(ll[i]) else: dp[idx] = ll[i] # print(l,dp) return len(dp) print(max(lis(l1),lis(l2)))