I want to eat something sweet..
for _ in range(int(input())):
= map(int, input().split())
n, k list[int] = list(map(int, input().split()))
a:
=True)
a.sort(reverseint = 0
tmp_sum: for ai in a:
if tmp_sum + ai > k:
break
+= ai
tmp_sum print(k - tmp_sum)
Alice: Maximize the number of unique marbles Bob: Minimize the number of unique marbles taken by Alice
For non-unique marbles, Bob is always able take one of them to prevent Alice from getting bonus points
from collections import defaultdict
for _ in range(int(input())):
int = int(input())
n: list[int] = list(map(int, input().split()))
c:
= defaultdict(int)
d for ci in c:
+= 1
d[ci]
= len(set(c))
colors = len([color for color, count in d.items() if count == 1])
unique print(colors + unique - (unique // 2) * 2)
Educational Codeforces Round 172 - Editorial
The solution makes sense, but I don’t think I can solve this problem next time. I don’t think I can replicate the mathematical operations for now.
However, denoting Si
as the score of
i, i + 1, ..., n - 1, n
and constructing a (sort of) sum
array seem to be a good approach to remember.
for _ in range(int(input())):
= map(int, input().split())
n, k list[int] = list(input())
s:
list[int] = []
vals: = 0
_sum for i in range(n - 1, 0, -1):
+= 1 if s[i] == "1" else -1
_sum if _sum > 0:
vals.append(_sum)
vals.sort()int = 1
ans: while k > 0 and vals:
-= vals.pop()
k += 1
ans
if k > 0:
print(-1)
else:
print(ans)
160.4 lb
Protein shake 50 g Protein chips 15 g Ice cream 0 g Fruits 0 g Yogurt 20 g Tofu 35 g Tuna salad 60 g
total protein -> 180 g (>= 140)
35 minutes run (hard), shoulder press
MUST: