All-Star

20515 Points

5713 Posts

### Re: need solution to this problem in c#- help

@ DMW

Hi Dave ... yes, i have read the problem definition many times from which i have concluded that the problem definition is defective because it allows for assumptions.

1. (a) the universe is definition by the O.P. as "an infinite integer grid".

(b) a co-ordinate system is not defined, only hinted at:

"The absolute value of each co-ordinate in the input will be at most 10^9"
{the O.P.'s choice of font size looks like 10_subscript 9;
i'm guessing the O.P. intended 10_superscript 9 ???}

2. Pythagoras could apply, i was giving Pythagorous as an example at to what i perceive as a flaw ...

```"eg: (x,y) can be reached from (x-1,y+1) in a single unit of time."
3,6                        2 , 7

9 ..........
8 ..........
7 ..o.......
6 ...o......
5 ..........
4 ..........
3 ..........
2 ..........
1 ..........
0 ..........

0123456789```

3. the problem definition, by constraining the ABSOLUTE VALUE of a coordinate is ipso facto constraining the distance.

4. one only needs "to work out the distance between the houses for the N people" BUT N can be 0 to 10000 houses ... i've made no assumption that every cell has a house (although every cell could have a house); from the set of ALL houses, at any given time, we will never select more that 10000 and those houses must be selected from houses within the implied distance constraint.

(we also are assuming varible speed because the problem definition speaks about uniform units of time rather that distance; thus moving diagonally from corner to corner takes the same time even though the Pythagorean distance is greater on the diagonal).

5. "daft" ??? ... maybe ... Dave, please note that this was introduced only to demonstate the weakness of the problem definition ... the problem definer imho should have left out houses and used something like "cell surface" instead.

----

Dave, the O.P.'s problem is looking for a c# solution and could be related to ASP.NET (albeit a stretch) if one is creating a web page to solve such problems.

As a former college teacher, and also as a tutor to university and college students, imho, when a problem is poorly defined, as this one is, the student needs to query the problem definer in order to have a clear problem statement

that may be difficult for the O.P. because the problem was simply found on some web page somewhere on the internet.

N.B.:  imho, the problem, as stated by the O.P., is unsolvable.

-----