結果
| 問題 |
No.1703 Much Matching
|
| コンテスト | |
| ユーザー |
mink1618033
|
| 提出日時 | 2021-10-09 02:01:32 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 468 bytes |
| コンパイル時間 | 492 ms |
| コンパイル使用メモリ | 82,660 KB |
| 実行使用メモリ | 189,920 KB |
| 最終ジャッジ日時 | 2024-07-23 11:22:41 |
| 合計ジャッジ時間 | 27,677 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 WA * 29 TLE * 4 -- * 1 |
ソースコード
import sys
input = sys.stdin.readline
n,m,q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(q)]
ab.sort()
lia = []
for a,b in ab:
lia.append(b)
ab.sort(key=lambda x:x[1])
lib = []
for a,b in ab:
lib.append(a)
def LIS(L):
from bisect import bisect
seq = []
for ai in L:
pos = bisect(seq, ai)
if len(seq) <= pos:
seq.append(ai)
else:
seq[pos] = ai
return len(seq)
print(max(LIS(lia),LIS(lib)))
mink1618033