結果

問題 No.1703 Much Matching
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-10-08 22:59:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 598 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 207,620 KB
最終ジャッジ日時 2023-09-30 12:13:17
合計ジャッジ時間 18,083 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
75,948 KB
testcase_01 AC 73 ms
71,052 KB
testcase_02 AC 76 ms
71,184 KB
testcase_03 AC 76 ms
70,616 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 WA -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
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 #

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)))
0