"So," Twilight Sparkle narrowed her eyes at the two ponies she had called into her office, Starlight Glimmer and Trixie. "Would either of you care to explain exactly what happened?"
Starlight and Trixie both turned their heads at each other, before nervously making eye contact with Twilight again. "Uh..." Starlight started, "where's the other one?"
Twilight sighed. "I HAD called them into the office too, but unfortunately they were cunning enough to skip town and lie low for a bit. You two, however, have no such excuses. So I'm asking you, again, exactly what happened."
Starlight started to shuffle nervously from hoof to hoof. Trixie, it seemed, was the only one brave enough to volunteer a response. "A lot happened. Trixie asks that you be more specific."
Twilight rubbed her forehead in frustration: it would seem Trixie's cheek was at least still intact after their ordeal. "Let's start then, with the report I got back from the Camel Kingdom. The two of you had arrived right outside the palace..."
"Uh huh," Starlight nodded.
"...where you met up with our too-smart-for-their-own-good friend, where they were vacationing after the stint in prison with Rainbow Dash last week..."
"Yyyyyup," Starlight said.
"...when a riot suddenly broke out in the town square due to Trixie's incredibly rash actions - "
"That pigeon had it coming!" Trixie suddenly shouted. "Ruined my hat with its droppings!"
"We didn't even know it was the favourite pet of the Camel King, we just got there!" Starlight threw up her hooves in protest. A thoughtful look crossed her face. "Having said that, aiming your entire stock of fireworks onto said pigeon was a bit overkill..."
"...great, so you admit it," Twilight groaned. "I swear the Map's going to call us out again just to apologise and patch up connections. So, WHY, exactly, were all three of you arrested when Trixie was evidently the sole aggressor?"
Starlight was trying very hard not to burst out laughing by gritting her teeth. "She...uh, made us hold the fireworks. We got arrested as accomplices."
"Good friends help one another, and I needed your help!" Trixie explained, as though it were the most obvious truth in the world.
Twilight raised a hoof to forehead again with an audible slap. She then held the report from the Camel Kingdom back up to her face. "You were then arrested for attempted assassination of a royal pet by two armed guards- "
"Three armed guards," Starlight raised her hoof, feeling a rather pedantic need to correct the purple alicorn. She soon found herself regretting that decision, as Twilight's angry face only grew angrier.
"THREE armed guards, then, where you spent a period of six hours before being released." Twilight glared at the pair. "How, exactly, did you three manage to avoid being found guilty and sentenced?"
"Oh, that pony, the puzzle-master, talked the jailor into giving us a chance," Trixie explained. "The jailor likes games and so he decided we bet to stake our freedom on one."
"And you won?"
"Evidently," Trixie said dryly.
"Don't back-sass me!" Twilight hotly shot back at the blue unicorn. She sighed. "So..." Twilight continued on, "what were the terms?"
"Well we weren't alone in the cell," Starlight explained. "There were twenty other prisoners in the jail, all of them also jailed for the same crime, under similar circumstances - "
"What, attempting to shoot the royal pigeon for leaving its...leavings, in the mane and clothes?"
"Really, you'd think it just does this on purpose. Trixie thinks it's doing it on purpose," the blue unicorn declared, adjusting her hat to hide the smirk on her face.
Starlight coughed. " - and we were all in the same boat, so they were playing with us. He explained we would be escorted to this room, one at a time, at random, where there were two switches, which were either on or off. We then had to either change the position of one of the switches, or leave it as is."
"And then?" Twilight raised an eyebrow.
"Well, if one of us could declare that all twenty-three of us had visited the room at least once, we'd all get pardoned and go free. If we got it wrong, we'd get fed to the prison's gingerbread spiders."
"Gingerbread spiders...and I thought that was just a mistake on the part of the written report..." Twilight sounded a little surprised, but it quickly passed, as her voice and face took on an angry mask once again. "And you succeeded?" she asked sharply.
"Basically. It was all the other pony's idea though. We just did as told."
The team nominates a leader. The group agrees upon the following rules:
The leader is the only person who will announce that everypony has visited the switch room. All the prisoners (except for the leader) will flip the first switch up at their very first opportunity, and again on the second opportunity. If the first switch is already up, or they have already flipped the first switch up two times, they will then flip the second switch. Only the leader may flip the first switch down, if the first switch is already down, then the leader will flip the second switch. The leader remembers how many times he has flipped the first switch down. Once the leader has flipped the first switch down 44 times, he announces that all have visited the room.
It does not matter how many times a prisoner has visited the room, in which order the prisoners were sent or even if the first switch was initially up. Once the leader has flipped the switch down 44 times then the leader knows everyone has visited the room. If the switch was initially down, then all 22 prisoners will flip the switch up twice. If the switch was initially up, then there will be one prisoner who only flips the switch up once and the rest will flip it up twice.
The prisoners can not be certain that all have visited the room after the leader flips the switch down 23 times, as the first 12 prisoners plus the leader might be taken to the room 24 times before anyone else is allowed into the room. Because the initial state of the switch might be up, the prisoners must flip the first switch up twice. If they decide to flip it up only once, the leader will not know if he should count to 22 or 23.
I know this one.
Ooh this one
each switch has 2 positions: on or off
Choose a leader(in this case it will be us)
Whenever we enter we hit the first switch
When ever anypony else enters,they hit the second switch, but only on their first time they come in, otherwise they leave it be
If the room is in the same state as we left it, do nothing, if not hit the first switch and add a count of 1
When the count hits 23 claim everyone has been there
...I see no way .