I understand that my solution is not the most efficient one for TRUEDARE problem. But it should work within the given constraints. But it is being evaluated as 'Time Limit Exceeded'. Can someone please point out the issue. Thanks.

https://www.codechef.com/viewsolution/23620718

Your solution will work in O((size11size12)+(size21size22)) value of this will be more than 10^8… So use sorting on all 4 arrays first and reduce complexity… Or use map to reduce complexity