MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / abs

Function abs

2018/src/23.py:10–11  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

8
9def part2(bots: list[list[int]]) -> int:
10 def abs(x):
11 return If(x >= 0,x,-x)
12 x,y,z,opt = Int("x"), Int("y"), Int("z"), Optimize()
13 opt.maximize(sum(If(abs(x-x1) + abs(y-y1) + abs(z-z1) <= r, 1, 0) for x1,y1,z1,r in bots))
14 opt.minimize(abs(x) + abs(y) + abs(z))

Callers 5

distFunction · 0.85
part1Function · 0.85
part2Function · 0.85
part1Function · 0.85
part2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected