인프런 커뮤니티 질문&답변
백준 2910 2-G 파이썬 코드 공유합니다!
작성
·
315
1
BOJ 2910
import sys
input = sys.stdin.readline
n, c = map(int, input().split())
a = list(map(int, input().split()))
cnt_dict = dict()
_order = list()
for i in a:
if not i in _order: _order.append(i)
print(*sorted(a, key=lambda x: (-a.count(x), _order.index(x))))




