nCases=int(input())
while nCases>0:
a=[]
c=[]
n,m,b=map(int,input().split())
for i in range(n):
t,x=map(int,input().split())
a.append((t,x))
a=sorted(a,key=lambda a:(a[0],-a[1]))
t0=a[0][0]
for i in a:
if i[0]==t0:
c.append(i)
b-=sum(c[v][1]for v in range(min(m,len(c))))
t0=i[0]
if b<=0:
break
else:
print('alive')
print(t0)
nCases-=1求问哪里不对qaq
--
您收到此邮件是因为您订阅了Google网上论坛上的“cs101pku”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到cs101pku+u...@googlegroups.com。
要发帖到此群组,请发送电子邮件至cs10...@googlegroups.com。
访问此群组:https://groups.google.com/group/cs101pku。
要查看更多选项,请访问https://groups.google.com/d/optout。