mynameishandsome

Untitled

Jun 13th, 2021
680
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hehe = int(input())
  2. a = []
  3. asss = []
  4. for i in range(hehe):
  5.     asd = []
  6.     kaka = input()
  7.     asd += int(kaka[0]), int(kaka[2])
  8.     asss += [asd]
  9. maxx = 0
  10. luot = 1
  11. tien = 0
  12. def quaylui(a,cc=0):
  13.     global maxx
  14.     global luot
  15.     global tien
  16.     if a == []:
  17.         return 0
  18.     elif luot !=0:
  19.         for i in range(0, len(a)):
  20.             tien += a[i][0]
  21.             if tien > maxx: maxx = tien
  22.             luot -= 1 - int(a[i][1])
  23.             index1 = a.index(a[i])
  24.             lmao = a.copy()
  25.             lmao.pop(index1)
  26.             quaylui(lmao,1)
  27.             tien -= int(a[i][0])
  28.             luot +=1
  29.     if cc == 0: return maxx
  30.  
  31. print(quaylui(asss))
RAW Paste Data