結果

問題 No.1703 Much Matching
ユーザー gew1fw
提出日時 2025-06-12 14:50:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 364 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,632 KB
実行使用メモリ 125,180 KB
最終ジャッジ日時 2025-06-12 14:54:04
合計ジャッジ時間 22,114 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 25 TLE * 1 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

n, m, q = map(int, input().split())
pairs = []
for _ in range(q):
    a, b = map(int, input().split())
    pairs.append((a, b))

pairs.sort()
b_list = [b for a, b in pairs]

tails = []
for num in b_list:
    idx = bisect.bisect_left(tails, num)
    if idx < len(tails):
        tails[idx] = num
    else:
        tails.append(num)

print(len(tails))
0