Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n=(int)(input("Valoarea lui n:"))
- m=[]
- i=0
- while i<n:
- x=(int)(input())
- m.append(x)
- i=i+1
- d={}
- cnt=0
- j=0
- ok=0
- i=0
- while i<len(m):
- if cnt in d:
- j=0
- ok=0
- while j<=cnt and ok==0:
- x=d.get(j)
- y=x[-1]
- if y>m[i]:
- d[j].append(m[i])
- ok=1
- else:
- j=j+1
- if ok==0:
- cnt=cnt+1
- d[cnt]=[m[i]]
- else:
- d[cnt]=[m[i]]
- i=i+1
- print(d)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement