We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
first_multiple_input=input().rstrip().split()n=int(first_multiple_input[0])m=int(first_multiple_input[1])arr=[]forindexinrange(n):arr.append((index,list(map(int,input().rstrip().split()))))k=int(input().strip())# sort by the k-th element and maintain order using the index as a secondary keyval=sorted(arr,key=lambdax:(x[1][k],x[0]))for_,rowinval:print(*row)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Athlete Sort
You are viewing a single comment's thread. Return to all comments →