結果

問題 No.1703 Much Matching
コンテスト
ユーザー mink1618033
提出日時 2021-10-09 19:27:12
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 502 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 511 ms
コンパイル使用メモリ 85,248 KB
実行使用メモリ 260,816 KB
最終ジャッジ日時 2026-04-04 03:58:57
合計ジャッジ時間 17,832 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline
import bisect

n,m,q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(q)]

ab.sort(key=lambda x:(x[0],-x[1]))

def LIS(lst,weakly=False,max_value=float('inf')):
    f=bisect.bisect_right if weakly else bisect.bisect_left
    dp=[max_value]*(min(n,m)+1)
    for x in lst:
        i=f(dp,x)
        dp[i]=x
    res=bisect.bisect_left(dp,max_value)
    return res

inf=1<<30
bl = [b for a,b in ab]
ans=LIS(bl,max_value=10**18)
print(ans)
0