| 123456789101112131415161718192021222324 |
- '''
- @author: olivier.massot, 2019
- '''
- import sys
- # houses = [int(input()) for _ in range(int(input()))]
- houses = [1, 15, 10, 13, 16]
- print(houses, file=sys.stderr)
-
- to_rob = []
- def max_independent_weight(weights):
-
- def with_and_without(i):
- if i < 0 or i >= len(weights):
- return 0, 0
- right = with_and_without(i + 1)
- return weights[i] + right[1], max(right)
-
- return max(with_and_without(0))
- print(max_independent_weight(houses))
|