Actually store the complexity; use precomputation