question: http://codeforces.com/contest/994/problem/C
please give hints, how to approach this problem..!!
Thank You
Asked by: Samrat_De on April 7, 2019, 6:34 p.m. Last updated on April 7, 2019, 6:34 p.m.
you can solve the subproblem first. the subproblem is to find that a point lies inside a square or not. for that, you can use area comparison method.
now you have to generate the center of each square and run the above function for both the squares in which you pass all the five points (four corners and one center, one by one) with the other square and if it returns true that means the two squares intersect else we run the function with other points. there are total (5+5) function calls we have to perform. if any of them is true then answer is yes else no.
if you have difficulty to understand this approach then try to draw some diagrams that would help.
note :) you can also use another approach which uses some successive conditional checking but it's too complex and I don't think that implementing it in short contest is a good idea, but I give some idea about that.
condition 1:- check if x segment of both squares intersect or not. if no then answer is no else go next condition.
condition 1:- check if y segment of both squares intersect or not. if no then answer is no else go next condition.
and so on some more conditions...