<jupyter_start><jupyter_text>说明：    您正在安装广告牌，并希望它具有最大的高度。    广告牌将有两个钢制支撑，每侧一个。    每个钢支架的高度必须相等。    您有一组可以焊接在一起的焊条。    例如，如果您有长度为1、2和3的杆，则可以将它们焊接在一起以制成长度为6的支撑。    返回广告牌安装的最大可能高度。    如果您不能支持广告牌，请返回0。Example 1:    Input: [1,2,3,6]    Output: 6    Explanation: We have two disjoint subsets {1,2,3} and {6}, which have the same sum = 6.Example 2:    Input: [1,2,3,4,5,6]    Output: 10    Explanation: We have two disjoint subsets {2,3,5} and {4,6}, which have the same sum = 10.Example 3:    Input: [1,2]    Output: 0    Explanation: The billboard cannot be supported, so we return 0.Note:    1、0 <= rods.length <= 20    2、1 <= rods[i] <= 1000    3、The sum of rods is at most 5000.<jupyter_code>import collections

class Solution:
    def tallestBillboard(self, rods) -> int:
        dp = collections.defaultdict(int)
        dp[0] = 0
        
        for r in rods:
            nxt = dp.copy()
            for d, y in dp.items():
                nxt[d + r] = max(nxt.get(d + r, 0), y)
                nxt[abs(d - r)] = max(nxt.get(abs(d - r), 0), y + min(d, r))
                print(dp)
            dp = nxt
        print(dp)
        return dp[0]
solution = Solution()
solution.tallestBillboard([1, 2, 3, 6])<jupyter_output>defaultdict(<class 'int'>, {0: 0})
defaultdict(<class 'int'>, {0: 0, 1: 0})
defaultdict(<class 'int'>, {0: 0, 1: 0})
defaultdict(<class 'int'>, {0: 0, 1: 1, 2: 0, 3: 0})
defaultdict(<class 'int'>, {0: 0, 1: 1, 2: 0, 3: 0})
defaultdict(<class 'int'>, {0: 0, 1: 1, 2: 0, 3: 0})
defaultdict(<class 'int'>, {0: 0, 1: 1, 2: 0, 3: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 3, 1: 2, 2: 2, 3: 0, 4: 1, 5: 0, 6: 0})
defaultdict(<class 'int'>, {0: 6, 1: 5, 2: 5, 3: 3, 4: 4, 5: 3, 6: 3, 7: 2, 8: 2, 9: 0, 10: 1, 11: 0, 12: 0})
{'fraction_non_alphanumeric': 0.2067686601761706, 'fraction_numerical': 0.10662957811775614, 'mean_word_length': 2.937956204379562, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '191651', 'license': 'Apache-2.0', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1035, 'n_words': 321, 'path': 'Dynamic Programming/1009/956. Tallest Billboard.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '2157'}