Help in question

Today is Valentine's Day and Kabir and Tara have decided to celebrate it. Now, both of them are going to park to spend some quality time together.

The city is in the form of a grid comprising of 0s and 1s where 1s denotes traffic signal at that position and 0s denote roads. They are already late, the location of home (x1,y1) and park (x2,y2) is given and they have to go such that there are minimum traffic lights in their way. You are a friend of Kabir, help him find a way to reach the park by crossing least number of traffic lights.

Note:There is no traffic signal at x1,y1 and x2,y2

First line will contain T, number of testcases. The description of T test cases is as follows.
First line of each test case contains r,c, number of rows and columns in grid.
Second line contains x1,y1.
Third line contains x2,y2.
Each of the next r lines contains a string the ith string describes the ith row of grid.

For each test case, print a single line containing minimum number of traffic signals that are required to be travelled.
So what is your question?

We will gladly help with questions, but we're not going to write your program (homework?) for you.
BUt how should I start ???
and our lovers drive down 53 extra streets to save 30 seconds at a light. This sounds exactly like how my gps is coded, where it tells you to get off the highway, drive down someone's driveway, thru a back alley, cross a parking lot, and get back on the interstate 1/4 of a mile from where you started.
Last edited on
another very interesting question I am unable to solve


Kabir likes Tara's smile and wants to look at her smile. They are sitting in the class and you are friends with Kabir. You have to place a mirror (point size) in the front wall of the class so that Kabir can have a glimpse of Tara's smile. Consider the front wall as x-axis . You are given the coordinates of position of Kabir (x1,y1) and Tara (x2,y2). Find the position where the mirror should be placed.
To start I would create a 2D array and read the input into it.
Then maybe some of the experts can give you some hints how to solve it.
Is this a codechef challenge.
( (x1y2+x2y1)/(y1+y2), 0 )
thanks @lastchance
Drat, it was a Codechef problem - mea culpa.

Hasn't much to do with coding, though.
any help with this one ... Given N the number of elements in the sequence A1,A2 … An. Find out the prime factor which occurred maximum number of times among the largest prime factor corresponding to each element. if there are more than one such prime factors print the largest one.
depends on the sequence(s). if its a linear sequence, for example, you know 2 will appear for 1/2 of the terms. 3 will appear for every third term. and so on. is it linear or otherwise expressed in a useful math way that lets you exploit that info?
Topic archived. No new replies allowed.