Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ContestSchedule():
- def expectedWinnings(self, x):
- t = []
- x = list(x)
- for i in x:
- a, b, c = map(int, i.split(' '))
- c = c / 100.0
- t.append([a,b,c])
- t.sort(key = lambda x:x[1])
- dp = [0] * len(x)
- for i in range(len(x)):
- dp[i] = t[i][2]
- for i in range(1, len(t)):
- for j in range(i):
- a1, a2, b1, b2 = t[i][0], t[i][1], t[j][0], t[j][1]
- if a2 <= b1 or b2 <= a1:
- dp[i] = max(dp[i], t[i][2] + dp[j])
- return max(dp)
Advertisement
Add Comment
Please, Sign In to add comment