PAT 1006 Sign In and Sign Out

m=int(input())
lst=[]
for i in range(m):
    a,b,c=input().split()
    b=tuple(map(int,b.split(":")))
    c=tuple(map(int,c.split(":")))
    lst.append((a,b,c))

#sorted排序之後仍是list。從小到大排序
out1=sorted(lst,key= lambda x:x[1])[0][0]
out2=sorted(lst,key= lambda x:x[2],reverse=True)[0][0]

print(out1,out2)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章