classSolution(object):defcomputeArea(self, A, B, C, D, E, F, G, H):"""
:type A: int
:type B: int
:type C: int
:type D: int
:type E: int
:type F: int
:type G: int
:type H: int
:rtype: int
"""if B >= H or D <= F or C <= E or A >= G:return((D-B)*(C-A)+(H-F)*(G-E))return(D-B)*(C-A)+(H-F)*(G-E)-abs(max(A,E)-min(C,G))*abs(max(B,F)-min(D,H))# 执行用时 : 116 ms, 在Rectangle Area的Python提交中击败了2.00% 的用户# 内存消耗 : 11.8 MB, 在Rectangle Area的Python提交中击败了0.00% 的用户