Advertisement
xah

Problem H: Parliamentary Rankings

xah
Mar 29th, 2017 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. actionPoints = {'S': 10, 'Q': 5, 'A': 7, 'L': -8, 'F': 4, 'D': -5, 'E': -10}
  2.  
  3. for oneWeek in range(7):
  4.     participants = int(input())
  5.  
  6.     nameDir = {}
  7.     actDir = {}
  8.  
  9.     for p in range(participants):
  10.         uniqueID, name1, name2 = input().split()
  11.         nameDir[uniqueID] = name1 + ' ' + name2
  12.         actDir[uniqueID] = 0
  13.  
  14.     actions = int(input())
  15.  
  16.     for a in range(actions):
  17.         uniqueID, action = input().split()
  18.         total = actionPoints.get(action, 0)
  19.         actDir[uniqueID] += total
  20.  
  21.     for i, d in actDir.items():
  22.         if d == max(actDir.values()):
  23.             keepH = i
  24.         elif d == min(actDir.values()):
  25.             keepL = i
  26.  
  27.     print(max(actDir.values()), nameDir.get(keepH))
  28.     print(min(actDir.values()), nameDir.get(keepL))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement