結果

問題 No.1703 Much Matching
ユーザー roaris
提出日時 2021-10-17 20:13:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 302 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 225,948 KB
最終ジャッジ日時 2024-09-17 19:45:52
合計ジャッジ時間 22,294 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import *

N, M, Q = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(Q)]
ab.sort(key=lambda t: (t[0], -t[1]))
dp = [10**18]*(N+1)
dp[0] = 0

for _, b in ab:
    dp[bisect_left(dp, b)] = b

print(bisect_left(dp, 10**18)-1)
0