Python代码
import sys
read_line = sys.stdin.readline
n, a, b = map(int, read_line().split())
fields = [list(map(int, read_line().split())) for i in range(n)]
s = 0
for x1,y1,x2,y2 in fields:
# 这四种情况与原区域没有交集
if x1 >= a or y1 >= b or x2 <= 0 or y2 <= 0:
s += 0
else:
# 有交集的情况计算重叠面积
s += (min(x2,a) - max(x1,0)) * (min(y2,b) - max(y1,0))
print(s)