{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThe 2018 World Cup was held recently in Russia. Some great soccer countries (e.g., Italy,Netherlands, Chile, USA) did not qualify for this World Cup. These countries have found out thatthey needed more effective passing.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cb\u003eThe Problem:\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eGiven the player positions for two teams, determine the minimum number of passes needed to getthe ball from one player to another player. For the purposes of this problem, players do not changeposition, i.e., they do not move.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003ePlayer P1 can pass the ball directly to P2 if they are on the same team and no other player is inbetween the two players.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eLet’s assume:\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eP1 and P2 are on the same team\u003c/p\u003e\n\u003cp\u003eP1, P2, P3 form a line with P3 between P1 and P2\u003c/p\u003e\n\u003cp\u003eThere are no other players on the line formed by P1, P2, P3\u003c/p\u003e\n\u003cp\u003eThen,\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eIf P3 is on the other team, P1 cannot pass the ball directly to P2.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eIf P3 is on the same team, P1 can pass the ball to P3 to pass it to P2.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cb\u003eThe Input:\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eThe first input line contains an integer, n (2 ≤ n ≤ 11), indicating the number of players on eachteam. The second input line contains 2n integers, providing the (x,y) coordinates for the n playerson Team 1; the first integer on this input line is the x coordinate for Player 1, the second integer isthe y coordinate for Player 1, the third integer is the x coordinate for Player 2, etc. The third inputline provides (in a similar fashion) the (x,y) coordinates for the n players on Team 2. Assume thatall coordinates are integers between 1 and 999 (inclusive) and that all players are on distinctlocations, i.e., no two players occupy the same spot (point).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eAssume Player 1 on Team 1 has the ball and wants to pass the ball to Player n on Team 1. Assumethat any player can pass the ball any distance.\u003c/p\u003e\n\u003cp\u003e\u003cb\u003eThe Output:\u0026nbsp;\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eThe output consists of a single integer, indicating the minimum number of passes needed to getthe ball from Player 1 on Team 1 to Player n on Team 1. If it is not possible to get the ball fromPlayer 1 to Player n, print -1.\u0026nbsp;\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n10 15 13 17 10 19\n10 17 16 17 13 19\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n1 1 3 1 5 1 7 1 9 1\n2 1 4 1 6 1 8 1 10 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e-1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n1 1 5 5 2 2\n10 10 50 50 20 20\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}