fix ternary operator in dslime.py (#1)

This commit is contained in:
Shuo Zhang 2025-05-26 18:18:38 +08:00 committed by GitHub
parent 18a552597a
commit 7b218f8e38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -189,5 +189,5 @@ Find the maximum possible final value. Put your answer in [answer]...[/answer]."
total = sum(a)
if any(x < 0 for x in a) ^ any(x >= 0 for x in a):
min_val, max_val = min(a), max(a)
return solution == (total - 2*min_val) if any(x >=0 for x in a) else (2*max_val - total)
return solution == ((total - 2*min_val) if any(x >=0 for x in a) else (2*max_val - total))
return solution == sum(abs(x) for x in a)