Frodo and Black Riders

Back to Problem Solutions forum

Vladimir_V     2015-10-02 18:14:48

Hi ! Couple of questions to admin: 1. 100 by 100 - it is X from -50 to 50 and Y from -50 to 50 ? 2. R = 20 + 15 * cos(theta) - What is exactly R here,the lenght of the vision filed or area or what ? 3. 20 and 15 are constants ? 4. how to link with all this data X and Y ?

Guy Gervais     2015-10-02 22:36:40
User avatar

I'm not admin, but I can give you a few answers:

  1. 100x100 is 0..99, 0..99

  2. R is the distance the Black Rider can see in that direction (theta)

  3. Yes, 20 and 15 are constant. Black Riders are all genetically equals :)

  4. You have to verify if Frodo at X,Y can be seen by each Black Rider; in other words, is he farther away than the distance R?

Vladimir_V     2015-10-03 07:45:58

Thanks a lot Guy Gervais :) But i dare to continue with couple more questions 1. As i can undestand the shape of vision field is nor circle, so R- the distance the Black Rider can see is different depending which direction we take. For example direction just in front of rider, probbably is equal with the R (is bigest one) but if take the back area of rider, then that distance of vision is minimal as we can see on the picture. So the main question is following: for every point (x=i;y=j) where i=o to i<99 and j=0 to j<99 we have different R to compare ? 2. Thus for every comparation between 0.99 and 0.99 (total 10000 points) we have acctualy (10000 individual R to compare with) That is right ?

Guy Gervais     2015-10-03 09:55:53
User avatar

R is given by the 20 + 15 + cos(theta) formula, so for each point you only have to calculate R for each riders and count how many times each rider can see Frodo.

Guy Gervais     2015-10-03 10:26:15
User avatar

I've just rechecked the problem and you should not just consider integer points. Frodo can be at location 14.131321312,56.97863221... and so on. 100x100 is actually 0.0 to 99.999999... squared.

Vladimir_V     2015-10-03 10:29:50

Ok!In other words.Example i take for example point (10,10) and for 4 riders a have 4 R ( 12, 13, 12.5, 14.6)

first case: distance from Frodo to any riders = 20, So This means that no ridesrs can see Frodo in point (10,10) beaccause all R are under 20 ? Thus this point belongs to safe area ? second case: distance from Frodo in point (10,10) to two riders is 5, So this mean that 5 is under 12 or 13 or 12.5 or 14.6 - whatever.Thus this point belongs to unsafe area ? Please just confirm that i am right :)

Vladimir_V     2015-10-03 10:32:34

Well in this case just for ( i to 100 ) and for( j to 100) does not work :(

Vladimir_V     2015-10-03 10:34:22

with 10000 iteration (100*100) still is possible to cjeck . But in the situation when we have 14.131321312,56.97863221... is to much olready :(

Guy Gervais     2015-10-03 10:42:48
User avatar

The checker seems to be a bit finicky. Sometimes checking all 10,000 integer points will work, other times not.

For the floating point value positions, you evidently cannot check them all, you need to take a fair sampling and use that. But even with a large sampling, the checker sometimes refuses what I think are good answers. You can refresh and get another set of points to try... (if you're sure your solution is good - it at least passes the test values)

Vladimir_V     2015-10-03 10:48:30

Thanks a lot :) And please confirm my third message. I am rihgt in third message i will try check first 0-99 to 0-99 version.

Guy Gervais     2015-10-03 10:56:52
User avatar

Make sure you get the right result for the test values. Once that works, you should be able to pass the problem if you refresh until you get an accepted answer. The 0..99 method seems to be harder to make pass than the "sample X random points" method from the few tests I made this morning...

Vladimir_V     2015-10-03 11:01:23

Dear Guy Gervais. I understand that with 0-99, 0-99 method is harder to get an accepted answer.But what iam trying to get from you is to confirm my thougths from third message :) "Ok!In other words.Example i take for example point (10,10) and for 4 riders a have 4 R ( 12, 13, 12.5, 14.6)

first case: distance from Frodo to any riders = 20, So This means that no ridesrs can see Frodo in point (10,10) beaccause all R are under 20 ? Thus this point belongs to safe area ? second case: distance from Frodo in point (10,10) to two riders is 5, So this mean that 5 is under 12 or 13 or 12.5 or 14.6 - whatever.Thus this point belongs to unsafe area ? Please just confirm that i am right :) "

Guy Gervais     2015-10-03 11:04:17
User avatar

Yes, that seems correct.

Vladimir_V     2015-10-03 11:10:30

Thaks a lot :) and more question :) I have a topic here Suffix Array Advanced and still i did not get any answer to my last question there :) Wouldbw so kind to take a look :)

Guy Gervais     2015-10-03 12:16:13
User avatar

I already had a look... not much to suggest, searching for "suffix array" works for me. Have a look on StackOverflow.

Please login and solve 5 problems to be able to post at forum