結果
問題 | No.1703 Much Matching |
ユーザー |
![]() |
提出日時 | 2021-10-08 23:35:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,948 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 49,792 KB |
最終ジャッジ日時 | 2024-07-23 07:49:45 |
合計ジャッジ時間 | 14,413 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
import bisectimport sysreadline=sys.stdin.readlinedef LIS(lst,weakly=False,max_value=float('inf')):f=bisect.bisect_right if weakly else bisect.bisect_leftdp=[max_value]*(min(N,M)+1)for x in lst:i=f(dp,x)dp[i]=xn=bisect.bisect_left(dp,max_value)return nN,M,Q=map(int,readline().split())AB=[[0]*M for i in range(N)]for _ in range(Q):a,b=map(int,readline().split())a-=1b-=1AB[a][b]=1lst=[]for a in range(N):for b in range(M-1,-1,-1):if AB[a][b]:lst.append(b)inf=1<<30ans=LIS(lst,max_value=inf)print(ans)