Advertisement
Guest User

kkakoy-to tournament1 generation

a guest
May 11th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. base1v1 = []
  2. base = []#it's base2v2
  3. #input_section
  4. for i in range(14): #14 is a count of members, I was able to use sys.stdin but thats simpler)
  5.     splitted_input_string = input().split()
  6.     nick = splitted_input_string[0].replace('_', ' ')
  7.     pp = int(splitted_input_string[1])
  8.     link = "https://osu.ppy.sh/u/" + nick
  9.     if '1v1' in splitted_input_string[2]:
  10.         base1v1.append([nick, pp, link])
  11.     if '2v2' in splitted_input_string[2]:
  12.         base.append([pp, nick, link])
  13. #input_section_end
  14. print('1v1 section:')
  15. sorted_base = sorted(base1v1, key = lambda l: l[1])#sorting by pp
  16. for i in sorted_base:
  17.     print(i[0], i[1], i[2])
  18. print('2v2 section:')
  19. sorted_base = sorted(base, key = lambda x: x[0])#sorting by pp
  20. for i in range(len(sorted_base) // 2): #by each element in reversed first half
  21.     print(f'{i+1}-st team is \n{sorted_base[i][1]}({sorted_base[i][2]}) + {sorted_base[-i - 1][1]}({sorted_base[-i - 1][2]}) [sum_of_pp = {sorted_base[i][0] + sorted_base[-i - 1][0]}]')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement