-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuva10141.py
More file actions
45 lines (26 loc) · 780 Bytes
/
uva10141.py
File metadata and controls
45 lines (26 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
if __name__ == "__main__":
i = 0
while True:
i += 1
proposals = []
try:
inp = input()
n,p = map(int, inp.split())
if n == 0:
break
for _ in range(n):
input()
for _ in range(p):
vendor = input()
price, reqs = input().split()
price = float(price)
reqs = int(reqs)
proposals.append((reqs, price, vendor))
for _ in range(reqs):
input()
proposals.sort(key=lambda e: (-e[0], e[1]))
print("RFP #%d"%i)
print(proposals[0][2])
except EOFError:
break