結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2017-05-03 22:43:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 414 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-31 11:31:02 |
合計ジャッジ時間 | 1,941 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
n = int(input()) w = sorted([int(i) for i in input().split()]) m = int(input()) b = sorted([int(i) for i in input().split()]) def dfs(n,m,s,c): ret = 0 if c == 0: for i in range(n,-1,-1): if w[i] < s: ret = max(ret,dfs(i-1,m,w[i],(c+1)&1)+1) else: for i in range(m,-1,-1): if b[i] < s: ret = max(ret,dfs(n,i-1,b[i],(c+1)&1)+1) return ret print(max(dfs(n-1,m-1,10**9,0),dfs(n-1,m-1,10**9,1)))