White Sheet - Timing


I was working on white-sheet from code forces and I used a brute-force method to solve the problem. I wasn’t really sure how to create a faster algorithm, to solve the problem. I was hoping someone could help me with that or give me a hint on how to solve the problem. My algorithm is O(n^2) right now.

Problem Link: Problem - C - Codeforces


calculate the remaining white area. Let’s say you have 3 sheets of A, B, C

remaining area = area(A) - area (A , B overlap) - area (A, C overlap) + area (A, B, C overlap)

If remaining area >0, answer = YES