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

Karma: 351
Deconectat Deconectat

Mesaje: 1.799



Vezi Profilul
« : Iulie 14, 2012, 20:04:13 »

http://infoarena.ro/blog/prison-synchronization
Memorat
unsilviu
Strain


Karma: 0
Deconectat Deconectat

Mesaje: 6



Vezi Profilul
« Răspunde #1 : Iulie 14, 2012, 20:21:31 »

 @Silviu sounds good but let's not spoil it yet.
« Ultima modificare: Iulie 14, 2012, 21:18:21 de către Cosmin Negruseri » Memorat
raduberinde
Strain
*

Karma: 13
Deconectat Deconectat

Mesaje: 26



Vezi Profilul
« Răspunde #2 : Iulie 14, 2012, 22:14:02 »

Adapting silviu's solution for the unknown initial switch state: each prisoner (except the designated) turns the switch on-to-off the first _two_ times they see it "on". The designated prisoner waits until she has counted 2(P-1)-1 on-to-off transitions and then declares everyone has been in the room. The idea is that if the switch is on in the beginning, whoever goes in first will turn it off, and we have "lost" one in the count. But that's ok, since 2P-3 counts are (in all cases) sufficient for us to know for sure all other P-1 prisoners were in the room at least once.
« Ultima modificare: Iulie 16, 2012, 14:19:24 de către Radu Berinde » Memorat
claudiumihail
Strain
*

Karma: 5
Deconectat Deconectat

Mesaje: 33



Vezi Profilul
« Răspunde #3 : Iulie 15, 2012, 18:09:14 »

Here's my idea for the case where the switch's state is initially known (off):

- The prisoners nominate one prisoner that will declare that all of them have visited the switch room
- Every prisoner except the nominated one follows these rules, when entering the switch room:
       a) If the prisoner has ever turned the switch off-to-on before he leaves the switch unchanged (in whatever state it was when he entered the room)
       b) If the switch is on, the prisoner leaves it unchanged.
       c) If the switch is off and the prisoner has never turned it off-to-on, the he turns it on and leaves.
- When the nominated enters the room he checks if the switch is off. If it is he does nothing and leaves. If it is on he turns it off and leaves. When the nominated prisoner has counted P-1 times that the switch was found in an on state he can declare that all prisoners have been to the switch room.

My idea is that each prisoner only turns the switch on once and only the nominated prisoner can switch it off.Thus the nominated prisoner can always be sure that when he finds the switch in an on state it was turned on by a different prisoner than the others before.
Memorat
Cosmin
Echipa infoarena
Nu mai tace
*****

Karma: 351
Deconectat Deconectat

Mesaje: 1.799



Vezi Profilul
« Răspunde #4 : Iulie 16, 2012, 21:29:30 »

You guys were fast Smile.
Memorat
rgrig
De-al casei
***

Karma: 46
Deconectat Deconectat

Mesaje: 144



Vezi Profilul WWW
« Răspunde #5 : Iulie 16, 2012, 23:05:06 »

I remember solving this problem during a pub crawl in Budapest in 2008. While somewhat drunk and with many hints it took me ~1h to solve the first part. Then Michal, who was posing the problem, said "what about if you don't know the inital state of the switch" and I immediately answered "ah, they just do it twice". IIRC, he looked at me a bit puzzled and said, "that's weird, it took me more time to solve the second half than the first."
Memorat
Pagini: [1]   În sus
  Imprimă  
 
Schimbă forumul:  

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