You are viewing a single comment's thread. Return to all comments →
def luckBalance(k, contests): # Write your code here
total_luck = 0 important_contests = [] for luck, important in contests: if important: important_contests.append(luck) else: total_luck += luck important_contests.sort(reverse=True) total_luck += sum(important_contests[:k]) total_luck -= sum(important_contests[k:]) return total_luck
Seems like cookies are disabled on this browser, please enable them to open this website
Luck Balance
You are viewing a single comment's thread. Return to all comments →
def luckBalance(k, contests): # Write your code here