Skip to content

Commit 70d540f

Browse files
committed
chore
1 parent d54f8ee commit 70d540f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

abc121/c/main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ def make_list(n, *args, default=0): return [make_list(*args, default=default) fo
4040
sys.setrecursionlimit(1000000)
4141

4242
def main():
43-
N = I()
43+
N, M = LI()
44+
AB = sorted(LIR(N))
45+
count = 0
46+
now = 0
47+
ans = 0
48+
while count < M:
49+
if AB[now][1] == 0:
50+
now += 1
51+
ans += AB[now][0]
52+
count += 1
53+
AB[now][1] -= 1
54+
print(ans)
55+
4456

4557
if __name__ == '__main__':
4658
main()

0 commit comments

Comments
 (0)