[READ-ONLY] Mirror of https://github.com/shuuji3/competitive-programming. 馃洬 Codes submitted to competitive programming platforms
aizu-online-jadge aoj atcoder hackerrank leetcode
0

Configure Feed

Select the types of activity you want to include in your feed.

1n = int(input()) 2l = list(map(int, input().split())) 3 4count = 0 5flag = True 6while flag: 7 flag = False 8 for j in range(n-1, 0, -1): 9 if l[j] < l[j-1]: 10 l[j], l[j-1] = l[j-1], l[j] 11 count += 1 12 flag = True 13 14print(' '.join(map(str, l))) 15print(count)