[알고리즘/백준] 15663번 : N과 M(9)(python)

유현민·2022년 7월 27일
0

알고리즘

목록 보기
224/253

permutations를 사용하여 풀었습니다.
중복 제거는 set을 이용했습니다.

import sys
from itertools import permutations


input = sys.stdin.readline


def solution():
    N, M = map(int, input().split())
    for i in sorted(set([i for i in permutations(list(map(int, input().split())), M)])):
        print(*i)


if __name__ == "__main__":
    solution()
profile
smilegate megaport infra

0개의 댓글