题解 | #成绩排序#
成绩排序
https://www.nowcoder.com/practice/8e400fd9905747e4acc2aeed7240978b
import sys n=int(input()) px=False if int(input()) else True names=[] scores={} i=0 for line in sys.stdin: a = line.split() names.append(a[0]) scores[i]=int(a[1]) i+=1 s=sorted(scores.items(), key=lambda x:x[1], reverse=px) for i in s: print(f'{names[i[0]]} {i[1]}')