Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1.  
  2. for i in range(len(n) - 1):
  3.     if n[i] >= n[i+1]:
  4.         nonspecialval = n[i]
  5.         nonspecialindex = i
  6.        
  7. lefthalf = n[:nonspecialindex]
  8. righthalf = n[nonspecialindex:]
  9.  
  10. nonspecialdamage = 1
  11.  
  12. for k in range(len(x)):
  13.     if k > nonspecialindex and n[k] < nonspecialval:
  14.         nonspecialdamage += 1
  15.  
  16. leftcurrindex = 0
  17. rightcurrindex = 0
  18. leftcounter = 1
  19. leftdamages = []
  20. rightdamages = [1] * len(righthalf)
  21.  
  22. while True:
  23.     if leftcurrindex > len(lefthalf) - 1:
  24.         break
  25.     if lefthalf[leftcurrindex] > righthalf[rightcurrindex]
  26.         leftcounter += 1
  27.         rightcurrindex += 1
  28.     else:
  29.         leftcurrindex += 1
  30.         leftdamages.append(leftcounter)
  31.        
  32. damages = leftdamages + [nonspecialdamage] + rightdamages
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement