dp, bitmask, shortest path -- amazing problem