Back to Problem Solutions forum
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 ?
I'm not admin, but I can give you a few answers:
100x100 is 0..99, 0..99
R is the distance the Black Rider can see in that direction (theta)
Yes, 20 and 15 are constant. Black Riders are all genetically equals :)
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?
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 ?
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.
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.
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 :)
Well in this case just for ( i to 100 ) and for( j to 100) does not work :(
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 :(
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)
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.
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...
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 :) "
Yes, that seems correct.
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 :)
I already had a look... not much to suggest, searching for "suffix array" works for me. Have a look on StackOverflow.