You are viewing a single comment's thread. Return to all comments →
#!/bin/python import sys def acumm(list): total = 0 for x in list: total += x yield total def smallest(cs1,cs2,cs3): a =len(cs1) b =len(cs2) c=len(cs3) if a <= b and a <= c: return cs1 elif b <= a and b <= c: return cs2 elif c <=b and c<=a: return cs3 else: return 0 def find_max(cs1,cs2,cs3): for i in smallest(cs1,cs2,cs3): if i in cs2 and i in cs3 and i in cs1: return i return 0 n1,n2,n3 = raw_input().strip().split(' ') n1,n2,n3 = [int(n1),int(n2),int(n3)] h1 = map(int,raw_input().strip().split(' '))[::-1] h2 = map(int,raw_input().strip().split(' '))[::-1] h3 = map(int,raw_input().strip().split(' '))[::-1] cs1 = list(acumm(h1))[::-1] cs2 = list(acumm(h2))[::-1] cs3 = list(acumm(h3))[::-1] val = find_max(cs1,cs2,cs3) print val
Equal Stacks
You are viewing a single comment's thread. Return to all comments →