Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. n=(int)(input("Valoarea lui n:"))
  2. m=[]
  3. i=0
  4. while i<n:
  5. x=(int)(input())
  6. m.append(x)
  7. i=i+1
  8. d={}
  9. cnt=0
  10. j=0
  11. ok=0
  12. i=0
  13. while i<len(m):
  14. if cnt in d:
  15. j=0
  16. ok=0
  17. while j<=cnt and ok==0:
  18. x=d.get(j)
  19. y=x[-1]
  20. if y>m[i]:
  21. d[j].append(m[i])
  22. ok=1
  23. else:
  24. j=j+1
  25. if ok==0:
  26. cnt=cnt+1
  27. d[cnt]=[m[i]]
  28. else:
  29. d[cnt]=[m[i]]
  30. i=i+1
  31. print(d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement