bsbg 提交的代码
提交时间: 2022 三月
语言: Python
运行时间: 40ms
占用内存: 3560K
Accepted
代码内容

登录之后查看代码,点此登录账号

from collections import defaultdict
while True:
	try:
		n, m = list(map(int, input().split()))
		numlist = input().split() # n elements, each elements of length m
		counter = [defaultdict(int) for _ in range(m)]
		for num in numlist:
			for i in range(m):
				counter[i][num[i]] += 1
		counter = counter[::-1]
		for cnt in counter:
			cnt = sorted(cnt.items(), key = lambda x:(x[1], -int(x[0])), reverse = True)
			print(cnt[0][0])
	except Exception as e:
		#print(e)
		break