結果

問題 No.1703 Much Matching
ユーザー tamato
提出日時 2021-10-08 22:14:52
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 552 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 263,588 KB
最終ジャッジ日時 2024-07-23 04:43:00
合計ジャッジ時間 20,864 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.readline

    N, M, Q = map(int, input().split())
    XY = []
    for _ in range(Q):
        XY.append(tuple(map(int, input().split())))

    XY.sort(key=lambda x: x[1], reverse=True)
    XY.sort(key=lambda x: x[0])

    LIS = [0]
    for _, y in XY:
        j = bisect_left(LIS, y)
        if j == len(LIS):
            LIS.append(y)
        else:
            LIS[j] = y
    print(len(LIS) - 1)


if __name__ == '__main__':
    main()
0