senb1

krsu 2259 (29 points)

Mar 29th, 2023
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. # by: senb1 aka amigo
  2.  
  3. n = int(input())
  4. a = list(map(int, input().split()))
  5.  
  6. m = 0
  7. ops = []
  8. for i in range(n):
  9.     for j in range(1, n):
  10.         if a[j-1] > a[j]:
  11.             a[j] += a[j-1]
  12.             ops.append((j-1, j))
  13.             m += 1
  14.  
  15. print(m)
  16. for x, y in ops:
  17.     print(x+1, y+1)
Advertisement
Add Comment
Please, Sign In to add comment