SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top