Puzzle 9. Break for it

- Black-3 calling for the Eye
- The Eye here, we are monitoring your movement, Black-3

This was the very beginning of the dialogue between former General of the Russian Empire now earning his bread as a killer ever since the nuclear blast and a veteran Ivan Demin. The upcoming task promised the vet a huge reward – a stack of 15 000 post-war Rubles – and all he had to do was trek through a radioactive forest to a specific location and collect the payload. Piece of cake!

The task was simplified further by his contractor assisting him along the way with a video feed from one of the remaining satellites. And it was the operator of this satellite that responded to the call for the Eye from the dialogue earlier.

- “I’m just 500 away from the coordinates, entering a field. Show me the location” – requested the veteran.
- “All is clear, Black-3, sharing the feed” – said the voice calmly.
- “Hold!” – the voice interjected – “I see another mutant there, could be more, prepare to engage! Tear me a new one, there’s more coming from the other side! Code red! Code red! I repeat, Code red! Let’s party Black-3!”

And her is the plot twist – you have to defeat the mutant in a tactical battle. The field can be fragmented into cells, with dimensions NxN.

Your job is to give intelligent commands, having the satellite perspective of the situation. Both, the veteran and the mutant move along the field in turns, taking any empty slot on the map. The aim is to break for it across the field and leave an unbroken trail of slots between the opposite ends. You must help the veteran make it to the other end where he will find a gun!

Aside from that it will be necessary to go through the following hypotheses to upgrade the knowledge about the mutants

1. Prove that the soldier is bound to win for any value of N
2. Describe the winning strategy with N = 7
3. Describe the winning strategy for any value of N

Puzzle 8. Eli

Imagine a city surrounded by a barren plain and left in ruins after the apocalypse. The winds carry clouds of smoke and smoldering ash obscuring the streets in a pale orange tint. At the entrance to the city, out of this dusty hue appears a man, tired but sturdy, wrapped up head to toe in loose rags, to protect against the scorching heat. He stops, unseals his pilot goggles and eyes up the city that he is planning to get across. Past experiences tell him that the streets are no walk in the park, down here he’s prey for those who have succumbed to their animal instincts, so, spending too much time on the ground could prove fatal and the safest route through the city is to traverse the rooftops. From a distant perspective the dark silhouette of a jagged city skyline could be represented as a broken line. The peaks of this line are located at coordinates (x1, y1), (x2, y2), ..., (xN, yN), with xi < xi+1. Our survivor transient, let’s call him Eli, has made it to his first rooftop and is standing at point (x1, y1). His mission is to get to (xN, yN). He has no means of transport other than his limbs. He must traverse the edge of the skyline (i.e. along the broken line), as well as that he is equipped with a grappling hook, which he can use to connect 2 peaks of the skyline with a rope: strictly from rooftop to rooftop, also, the rope cannot go through a building. The length of one rope is limited to R. The shots of the grappling hook are limited to K. After each shot, the used rope is left behind and cannot be reused. What is the shortest possible distance that Eli must traverse in order to get to (xN, yN), given that at times he will have to resort to taking his chances on the street?

Input Data

The program must register a natural number N (2N64); then, a whole number R (0K10000), which represents the maximum length of one rope; then a whole number S (R ≤ S ≤ 10000), which represents the total length of all ropes put together. Then the coordinates (x1, y1), (x2, y2), ..., (xN, yN). All coordinates are real numbers, not exceeding 10000, for all values of i from 1 to N-1, take xi < xi+1.

Output Data

The program must produce one number to represent the minimum distance, which Eli should cover (on the street and rooftops). The answer should have precision to 5 decimal places.

Puzzle 7. Evacuation

A former office building was buzzing with other activities – a group of armed men have completed preparations for the upcoming operation in a precise and coordinated manner.

- “Warden, the package is almost ready, how do you want us to get it down?” – inquired one of the soldiers into his handheld radio.
- “You’re really trying my patience, Casing, can you just shut up and get the bomb here already!” – snapped the fierce voice on the other end – “Have we got that?”
- “Yes, sir…over.” – replied casing in compliance and clipped the radio back to his chest. – “Well its going down one way or another.” – he continued – “Hydrant, you heard the boss! Take this motherfucker down the elevator.”

The two guys spent the next couple of minutes puffing and grunting trying to load the vacuum bomb onto a simple of trolleys. Everything was going well until…

- “Hey there, Casing, that blinking red light and the bleeping sound is normal, right?” – speculated Hydrant. – “It also shows the current time… Crap, it doesn’t look like the current time actually! 58:59 … 58:58
- “Erm, Warden, we have a slight problem here…” Casing reached for the radio.
- “You’ve gone and activated the bomb, haven’t ya?! You fools!” – shouted Warden – “All squad, evacuate the premises! Let’s pack it in and get the hell out of here. We have an hour before everything within a kilometer radius gets swallowed up!”

There are n number of people scattered throughout the building. For an orderly and efficient evacuation, it is necessary to model the retreat of the whole squad via the ground floor, using the elevator

A soldier comes up to the elevator hall to call for a lift, if the button is already pressed, he simply joins the wait. Hence, this way it may be that several people are waiting to take the elevator at any given floor. The load may get heavy.

Only one call for the elevator can be active at any one time.

Initially the elevator is vacant and situated on the ground floor. When the first call button is pressed, this call becomes active and the lift goes up to the required floor. If the call is made from several different floors at the same time, the call from the soldier with the lower serial number gets the privilege. The elevator moves at the speed of one floor per second. When the elevator gets to the required floor, all soldiers waiting on that floor enter it, and descend to the ground floor. On its way down, the elevator may respond to a call on the lower floors, provided the floor has not been passed yet. All those waiting on that floor also get on, and continue their descent. Once the elevator leaves a floor, the call button resets. The elevator reached ground floor, all passengers step out, the elevator remains in waiting mode, until someone presses the button on another floor.

If, when having reached the ground floor, other calls on the upper floors are awaiting service, then the call with the highest privilege turns active. The elevator keeps operating like this until all people have evacuated the building.

Let’s assume that everybody understands the seriousness of a vacuum bomb, and all entering and exiting of the elevator happens instantaneously. It is required to use the computer resources at hand to model a simulation which tells when exactly a person will get to the ground floor, taking into account the privilege hierarchy.

Simulation data: first row contains n and m representing the quantity of soldiers calling for a lift and the number of storeys in the building, respectively, (1 ≤ n ≤ 105, 2 ≤ m ≤ 109). The following n rows describe the soldiers, i from this row contains two whole numbers– ti being the second that it takes the soldier to approach the elevator and ai the floor number, where this is taking place (1 ≤ t1 ≤ t2 ≤... ≤ tn ≤ 109, 2 ≤ ai ≤ m). The result of the simulation must contain n of whole numbers, for each soldier should be given a second to exit the elevator on the ground floor.

Puzzle 6. The sacred door

It’s been sixteen years since the last nuclear attack against the Russian Empire, and the area that once was part of a huge megapolis now resembles something closer to a scene out of a horror flick, and not the grandiose city with millions of inhabitants it once was. However, even in times like these, the city is not completely abandoned. Inhabited by some desperate survivors – shady characters, thieves, stalkers, assassins, and dangerous gangs. They are all concerned with one thing – survival at any cost, when even meagre resources have to be fought for.


It’s been a while since you became part of the gang calling themselves the Red Dawn. You try to not commit heinous crimes and this has helped your leaders to stay in dialogue with the local Imperial Guard, who come to descum the area from time to time. The Imperial Guards visit strictly every second Thursday. It’s Wednesday now and with just 24 hours remaining before their next visit you are pressured for time to gather resources to appease the squad and stay alive at least another 2 weeks. The target of your run is a half-ruined building, once headquarters of a large corporation.


It didn’t take you long to find the entrance and start scouring for something to salvage. All of a sudden, your flashlight catches something resembling a dusted up safe, but its too early to cheer. Unlike the destruction all around, the safe itself is in perfect condition, TNT and picks would prove useless here, we’ll have to resort to a more technologically advanced stratagem.


At the very centre of the door there is a disk with barely noticeable numbers engraved on it. Most of the numbers were already indiscernible, but they likely ranged from 0 to 99 sequenced clockwise around the edge of the disk.


While you were scratching your noggin over the safe-door, one of your teammates pulled out from the dusty rubble something that looked like a console with 2 buttons labeled “left” and “right” and some archaic ports for connecting to it. The next 15 minutes you spent trying to fix the only remaining and more or less functioning cable that you could find and connecting the console to the safe. By pressing “right” the disk rotates R amount clockwise, by pressing “left” the disk rotates L amount anticlockwise. Each move is followed by a click and takes 1 second to complete. Initially these sorts of locks have to be set to 0. The lock opens when the dial hits K – the safe key.


Before you start unlocking, you need to ask yourself this: can it be stated with certainty that 1 minute is enough to guarantee an opened lock whatever the value of K, given that R=23 and L=16?


While your team is deciding this you have the opportunity to work out a program which calculates the minimum required time to open the safe with the given R and L values. K may be specified or left undefined. Perhaps this will help you get to the contents of the safe faster and make it back to your base in time for Imperial Guards.

Puzzle 5. Quicksilver refinery

The Lord of the Wastelands and keeper of the holy guzzolene, the one and only Immortan Joe has bestowed upon you a mission – to deliver the next shipment of guzzolene, to a quicksilver refinery in exchange for some ammunition, weapons and cheeseburgers. You are to be escorted by Joe’s trusted gang of halflife warriors. They wish to organize their own teams for escorting the precious fuel. It was decided that in order for a halflife warrior to sign up for a team, he must have at least one friend in that team. Therefore, we assume that if the first member of a team knows the second one, then conversely, the second fellow knows the first. Each team is assigned to a separate assault truck, hence, for economic reasons we have to keep the number of teams to a minimum.

The only thing left to do is load up the trucks and write up a list of troops for each of vehicle. Design a program that would help us solve the latter.

Given data

The first row contains 2 numbers: N — represents the number of halflife warriors, M — is for the number of rows representing the relationship between the warriors 0≤N, M≤1000. The following M-rows contain pairs of natural numbers 1≤a, b≤N, representing that warrior ‘a’ is friends with warrior ‘b’.

Input data

The first row is T – representing the number of assault trucks. The following rows are a breakdown of each truck: [number of passengers]; dogtag numbers listed in their ascending order. Start a new row for each truck required. Each halflife warrior must be assigned to one and only one assault truck. If several correct answers are possible give either one.  

Puzzle 4. The Chatlans

The inhabitants of planet Plook in the Kin-dza-dza constellation fall into two categories: the Chatlan and Patzac. The local Patzac population have a secret greeting called “Coo”, which only a true Patzac can pass. This greeting between two Patzacs looks something like this:

  1.      Mr.A thinks of a natural number x – the variable, not larger than N-1 and communicates the value of F(x) to Mr.B, Mr.B in turn answers with a number F(x+1);

  2.      Mr.B thinks of a natural number y – the variable, not larger than N-1 and communicates the value of F(y) to Mr.A, Mr.A in turn answers with a number F(y+1).

The value of F is equal to the remainder of dividing the variable cubed by N. Prove that you are a true Patzac and find x and y, given that one of the greetings had the following number sequence emerge: 5713, 5783, 7821 and 7870. The value of N has been chosen so that the value of the variable is defined specifically by the function F.

Puzzle 3. The road

In the not-so-distant future a society depending only on fuel economics have fallen victim to a total collapse of the civil code. The civilization came to an end. People have stopped valuing heroes. The only people making up the society now are psychopaths, road patrols and ordinary civilians. Mad Max’s mad brother Max is an officer of the main patrol unit. Following a loss of his entire family and all his friends during the apocalypse, he vowed to protect civilians and save as many lives as possible.

On one of his patrol shifts he encounters 5 people: 2 psychopaths, 2 civilians and 1 patrol officer. He knows that psychos always lie, and that officers and civilians do not have it in them to tell a fib. The 2 psychos know who they are. The officer is likely to tell between a psycho and a civilian. Civilians know only about themselves and trust nobody. Mad Max’s mad brother Max listens to all testimonies in turn:

A: I know who B is.

B: I know who the officer is.

C: I know who B is.

D: I know who E is.

Help Max identify who is who.

Puzzle 2. Tripping out

The north of the capital city Fosantier has long been the zone of alienation and a gulag for criminals and Ruthpangas – week, feeble semi-intelligent bipods who have regressed into the endless labyrinth of the sewers and in the damp and romantic darkness have managed to mutate into having a somewhat advantageous trait. Their bodies excrete an oily slime which helps them to slick through tight spaces, time and time again saving them during the regular clean-up operations that the authorities initiate in the district. Although, this gang of bobble-head freaks reaps the benefits of this slime, for regular humans contact with this toxic secretion means a hell of a trip. A mind-altering, time-dilating, narcotic experience that is rather a psychotic challenge than an after-work chill-out with friends. A person exposed to this chemical experiences light nausea for the first hour, their perception of reality skews only slightly, biological clocks align with the real time. However, exactly one hour later, the effect takes on unfathomable heights – the mind burns through the fabric of reality like a hot coal placed on a thin sheet of plastic and falls down a bottomless pit, where up is down, black is white, minutes last hours and hours pass like minutes. Luckily, precisely an hour later the person comes to, and their senses normalize to light dizziness, and so it goes alternating for a full 24 hours, resulting in the victim going completely and irreversibly insane or worse…

On one of the recent clean-ups a rookie unit – pte. Fourleaf – got into a chasing frenzy with a Ruthpanga. As Fourleaf came scraping his way through cracks and jams after the Ruthpanga, he inevitably came into contact with some of his slime. Instantly he started feeling sick, he checked his watch and panicked – here he was lost in a dark labyrinth at midnight, his prey Ruthanga was long out of sight, and he was about to experience a hallucinogen similar to an LSD overdose. Sure enough, an hour later, his consciousness sizzles through the ground he was sitting on and he began his descent into oblivion. Fearing the unknown, Fourleaf was rummaging through what was left of his cognition to figure out a way to beat this. His best idea was first to gain control of his biological clocks. To do this he was convinced he had to cut into his wrists with a knife every moment when his perception of time matched the actual time. Crazy began to set in, but we want to help the guy out. Given that for Fourleaf, time runs regularly one hour and the next hour the minutes slow down to hours and the hours speed up to minutes, help Fourleaf figure out the schedule for the next 24 hours of moments when he has to score his wrists (ignoring the first hour, of course, since this brilliant idea came afterwards). 

Puzzle 1. Radiotherapy

Some of our troops have been bitten by zombies on the last supplies run. At the moment they are all in quarantine. The process of radiotherapy is due to begin this evening, once all the troops segregated into their own cells. The procedure room has an X-ray lamp which is initially switched to off. The troops are taken from their cells to the procedure room in turns one at a time. After the procedure, the troop leaving the room may leave the X-ray lamp switched either on or off.

If at any moment either of the troops says that all of the infected units have undergone the therapy, and turns out to be correct, then the therapy shall be deemed successful and all troops will be released. If on the other hand he turns out to be wrong, then part of the soldiers will die. Do not worry of anyone of them being left out, if all troops keep their mouths shut long enough, then all of them will visit the procedure room, and no visit is final.

Come up with a strategy for them to agree on now, while together in quarantine, to ensure health and life for all soldiers.