- 버블 정렬
- Python3로는 시간 초과, PyPy3로는 AC
import sys
input = sys.stdin.readline
A, K = map(int, input().strip().split())
array = list(map(int, input().strip().split()))
cnt = 0
def bubble_sort(array):
global cnt, K
for i in range(len(array) - 1, 0, -1):
for j in range(i):
if array[j] > array[j+1]:
cnt += 1
array[j], array[j+1] = array[j+1], array[j]
if cnt == K:
print(*array)
sys.exit(0)
if cnt < K:
print(-1)
sys.exit(0)
bubble_sort(array)