Skip to content

Commit

Permalink
CF2036B Startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Nov 25, 2024
1 parent c856a3e commit a25ee4a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions codeforces/cf2036b_startup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Vicfred
# https://codeforces.com/contest/2036/problem/B
# greedy

t = int(input())
for testcast in range(t):
n, k = list(map(int, input().split()))
#print(n, k)
MAXN = k + 2
sodas = [0]*MAXN
for bottle in range(k):
brand, price = list(map(int, input().split()))
sodas[brand] += price
answer = 0
sodas.sort(reverse=True)
for i in range(min(n, len(sodas))):
answer += sodas[i]
print(answer)

0 comments on commit a25ee4a

Please sign in to comment.