황소개발자
백준 15664 파이썬 python : N과 M (10) @@황소처럼 우직하게@@ 시간초과 안나넹 본문
반응형
n, m = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()
anses = []
a = [0 for i in range(m)]
def go(idx, selected, n, m):
if selected == m:
if a not in anses:
anses.append(a.copy())
return
if idx == n:
return
a[selected] = num_list[idx]
go(idx + 1, selected + 1, n, m)
a[selected] = 0
go(idx + 1, selected, n, m)
go(0, 0, n, m)
for ans in anses:
print(' '.join(map(str, ans)))
반응형
'백준 문제 풀이' 카테고리의 다른 글
백준 15666 파이썬 python : N과 M (12) @@황소처럼 우직하게@@ 드디어 끝 (0) | 2020.03.02 |
---|---|
백준 15665 파이썬 python : N과 M (11) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
백준 15663 파이썬 python : N과 M (9) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
백준 15657 파이썬 python : N과 M (8) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
백준 15656 파이썬 python : N과 M (7) @@황소처럼 우직하게@@ (0) | 2020.03.02 |
Comments