You are viewing a single comment's thread. Return to all comments →
`def solve(P: list[int]) -> float: return 0 if sorted(P)==P else math.factorial(len(P)) / math.prod(math.factorial(v) for v in Counter(P).values())
Seems like cookies are disabled on this browser, please enable them to open this website
Lazy Sorting
You are viewing a single comment's thread. Return to all comments →
`def solve(P: list[int]) -> float: return 0 if sorted(P)==P else math.factorial(len(P)) / math.prod(math.factorial(v) for v in Counter(P).values())