Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions μ–‘κΆλŒ€νšŒ.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def solution(n, info):
best = [-1]
max_diff = 0
def dfs(i, left, shot):
nonlocal best, max_diff
if i == 11:
shot[10] += left
scores = [(10 - j) * (s > a) for j, (s, a) in enumerate(zip(shot, info))]
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using an explicit conversion (e.g., '(1 if s > a else 0)') rather than relying on boolean-to-integer conversion for clarity.

Suggested change
scores = [(10 - j) * (s > a) for j, (s, a) in enumerate(zip(shot, info))]
scores = [(10 - j) * (1 if s > a else 0) for j, (s, a) in enumerate(zip(shot, info))]

Copilot uses AI. Check for mistakes.
lion = sum(scores)
apeach = sum(10 - j for j in range(11) if info[j] and shot[j] <= info[j])
if (diff := lion - apeach) > 0:
if diff > max_diff or (diff == max_diff and shot[::-1] > best[::-1]):
best, max_diff = shot[:], diff
shot[10] -= left
return
for x in (info[i] + 1, 0):
if x <= left:
shot[i] = x
dfs(i + 1, left - x, shot)
shot[i] = 0
dfs(0, n, [0] * 11)
return best