Pagini: [1]   În jos
  Imprimă  
Ajutor Subiect: Fox Hunting  (Citit de 6308 ori)
0 Utilizatori şi 1 Vizitator pe acest subiect.
Cosmin
Echipa infoarena
Nu mai tace
*****

Karma: 351
Deconectat Deconectat

Mesaje: 1.799



Vezi Profilul
« : August 31, 2012, 09:27:51 »

http://infoarena.ro/blog/fox-hunting
Memorat
wefgef
Nu mai tace
*****

Karma: 1049
Deconectat Deconectat

Mesaje: 3.008


razboinicu' luminii


Vezi Profilul
« Răspunde #1 : August 31, 2012, 09:45:43 »

Isn't this just a particular case for this problem: http://infoarena.ro/problema/boom?
Memorat

omului i-au fost date instinctele pentru a supravietui, nu pentru a fi sclavul lor.
Cosmin
Echipa infoarena
Nu mai tace
*****

Karma: 351
Deconectat Deconectat

Mesaje: 1.799



Vezi Profilul
« Răspunde #2 : August 31, 2012, 09:49:15 »

I said don't spoil it Tongue

That problem asks for the minimum number of steps while I ask for a strategy.
You can solve this one in your head and also generalize to higher n. In the problem you mention the solution is exponential.
Memorat
freak93
Echipa infoarena
Nu mai tace
*****

Karma: 342
Deconectat Deconectat

Mesaje: 819



Vezi Profilul
« Răspunde #3 : August 31, 2012, 11:06:05 »

Isn't it just enough to check all holes from first to last twice?(Like 1 2 3 4  .... 11 1 2 3 ... 11)
Memorat
mips
Strain
*

Karma: 1
Deconectat Deconectat

Mesaje: 30



Vezi Profilul
« Răspunde #4 : August 31, 2012, 11:22:57 »

If the holes are numbered from 0 to 10, first assume that the fox is in an odd numbered hole(let's call "F" the position of the fox). F switches between even and odd every step that the fox makes.
Since now F is odd, it can't be 0, so we check hole 1. If F != 1, F must have been one of 3,5...9, so in the next step we are certain that F will be at least 2. We check further in hole 2. If F!=2, then F certainly is one of 4,6,8,10 so F will be bigger than 2 in the next step. And so on until we reach hole 9. If F!=9 we have reached a contradiction( if our assumption was correct, in this point F should be odd, but we are also certain F >9). Then F must have been an even number initially. But 9 steps have passed, so F must be odd now. We repeat the whole process, being certain that this time we will find the fox.
18 steps are needed in worst-case.
« Ultima modificare: August 31, 2012, 16:52:20 de către Pavel Mircea » Memorat
PetcuIoan
Strain
*

Karma: 72
Deconectat Deconectat

Mesaje: 49



Vezi Profilul
« Răspunde #5 : August 31, 2012, 13:21:27 »

You made a error : it's feel free not fell free.
Memorat
elfus
Client obisnuit
**

Karma: 77
Deconectat Deconectat

Mesaje: 96



Vezi Profilul
« Răspunde #6 : August 31, 2012, 14:05:28 »

Does the fox know what you checked last time? I mean does the fox chooses next possibility random or based of an optimal strategy depending of your last move?
Memorat
klamathix
Echipa infoarena
Nu mai tace
*****

Karma: 733
Deconectat Deconectat

Mesaje: 1.216



Vezi Profilul
« Răspunde #7 : August 31, 2012, 14:28:19 »

@Florin. It doesn't really matter. You have to devise a strategy that will certainly succeed, which basically means that you should take into account any possible outcome, including the case in which the fox acts or seems to act based on your previous movements. It's not relevant if it's choice or randomness, it's a case you should consider anyway.

@Petcu You made an error. It's 'an' error, not 'a' error Smile.
Memorat
PetcuIoan
Strain
*

Karma: 72
Deconectat Deconectat

Mesaje: 49



Vezi Profilul
« Răspunde #8 : August 31, 2012, 16:08:17 »

@Mihai, are you shure? I think my english is in an fine state.
Memorat
Cristy94
De-al casei
***

Karma: 37
Deconectat Deconectat

Mesaje: 128



Vezi Profilul
« Răspunde #9 : August 31, 2012, 18:19:29 »

I have made a small javascript app for those who want to check their solution in a visual way Very Happy
Have fun: http://jsfiddle.net/hncnn/18/
« Ultima modificare: August 31, 2012, 23:12:28 de către Buleandra Cristian » Memorat
teo2mirce
Strain


Karma: 2
Deconectat Deconectat

Mesaje: 5



Vezi Profilul
« Răspunde #10 : August 31, 2012, 18:40:51 »

@Budau Adrian

You'r method work only for 92% of the time i tried it 10 milion times in an application.
Memorat
veleandu
De-al casei
***

Karma: 155
Deconectat Deconectat

Mesaje: 132



Vezi Profilul
« Răspunde #11 : August 31, 2012, 22:45:16 »

Adi's solution works fine Smile
And you only need to check the holes from 2...10 and 2...10
It's the same solution that Mircea told ... But in a very short. I will come shortly with an example. You can generate all the positions that the fox could be possible in, in you will see that after going those steps the fox can't be anywhere
Memorat
Jogu
Strain


Karma: 2
Deconectat Deconectat

Mesaje: 7



Vezi Profilul
« Răspunde #12 : Septembrie 01, 2012, 10:09:38 »

it's all about the parity of the fox position.

1) if you and the fox have the same parity then starting from 1 going to end(in one step), you will meet the fox surely somewhere.

2) if you have different parity from the fox, then going from 1 to end you will not meet the fox for sure. that means, at the end of the line, you will know the parity of the fox position(is different from your parity) and you will find it for sure(because now you use the first case).
« Ultima modificare: Septembrie 01, 2012, 11:46:45 de către Teodor » Memorat
crushack
De-al casei
***

Karma: 23
Deconectat Deconectat

Mesaje: 108



Vezi Profilul
« Răspunde #13 : Septembrie 04, 2012, 12:49:48 »

I think the solution is:
Suppose we have the holes numbered from 1 to N
so we check holes 2..N-1 then N-1..2
and it works Very Happy

Tried it on paper Very Happy
Memorat
toranagah
Strain


Karma: 2
Deconectat Deconectat

Mesaje: 5



Vezi Profilul
« Răspunde #14 : Septembrie 04, 2012, 18:17:41 »

I have found the solution of iterating through hole 2-10 twice(I read the comments after and saw the other similar response). Don't know if it is truly correct but I tried it against 10 billion random tests and it worked for every single one.
Memorat
Cosmin
Echipa infoarena
Nu mai tace
*****

Karma: 351
Deconectat Deconectat

Mesaje: 1.799



Vezi Profilul
« Răspunde #15 : Septembrie 04, 2012, 22:50:19 »

Testing on random movements is a bad idea.

For example the following hunting strategy:
1 1 1 1 ... 1 ..
catches the fox at some point because the probability of a point moving randomly to the left or right reaching the first position is 1.
But this strategy is obviously wrong because the fox can get away from the hunter if she just doesn't go to hole 1.

The people above mentioning the even odd strategy have the right solution.
Memorat
crushack
De-al casei
***

Karma: 23
Deconectat Deconectat

Mesaje: 108



Vezi Profilul
« Răspunde #16 : Septembrie 04, 2012, 23:41:49 »

I admit the even odd solution to be correct, but you don't have to bother with that:
if you check all the holes from 2 to N-1 then you'll be left with the fox on an even number (if the number is odd) or on an odd number (if the number is even). But, if you take them from N-1 to 2 you don't have to bother with even odd case, because if N is even then N-1 is odd and the other way around.

Thank you for your patience Very Happy
« Ultima modificare: Septembrie 05, 2012, 01:11:48 de către Popescu Silviu » Memorat
Pagini: [1]   În sus
  Imprimă  
 
Schimbă forumul:  

Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines