a guest Feb 27th, 2020 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lista=[]
  2. imiona=[]
  3. for n in range(int(input())):
  4.     l,p=input().split()
  5.     l1,l2=l.split(":")
  6.     p1,p2=p.split(":")
  7.     l2=int(l2)
  8.     p2=int(p2)
  9.     if l1 not in imiona:
  10.         imiona.append(l1)
  11.         lista.append([l1,0,0])
  12.     if p1 not in imiona:
  13.         imiona.append(p1)
  14.         lista.append([p1,0,0])
  15.     for e in lista:
  16.         if l1==e[0]:
  17.             e[2]+=l2
  18.             if l2>p2: e[1]+=1
  19.         if p1==e[0]:
  20.             e[2]+=p2
  21.             if p2>l2: e[1]+=1
  22. lista.sort(key=lambda z:(-z[1], -z[2], z[0]))
  23. for e in lista:
  24.     print(e[0])
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