[Community Puzzle] Robot show

Yes, I did it. Friend did give me a clue. Rather to think about bouncing robots, better is to think that they are passing each other.

Very nice idea - big like to this puzzle
“Passing the box” is indeed a clever hint

And indeed, the “EASY” describes the end solution. Reaching it involves getting “out of the box” which is anything but easy :slight_smile:

I’m stuck at the same point. (Test 2 … 19 instead of 20)

I ran the simulation with all 128 (2^7) possible direction combinations and I did not get any result with 20 seconds - maximum is 19 seconds.
@java_coffee_cup can you please provide how you get to 20 seconds??

> > > < >  <  <
1 2 6 7 10 14 20

this can be one of the possible start up designs.

1 Like

Thx for fast answer.

Since I got also only 19s with your left-right-combination I realized a that the problem must be somewhere else.

After some tries it became clear that it was connected to the robot [20] → for my understanding a bot at 20 means it is out (following the rule from the example where the bot is out when hitting 10). After considering this bot to be in everything worked fine :+1:

1 Like

Your analysis can be useful to future comers. A bot at 0 or 20 (the extreme right-hand-side) are going out if they face outwards; they are coming in if they face inwards,

My mind was BLOWN by this puzzle.
I wish it was possible to add more stars, best one I’ve made by FAR! it’s… just… wow.

1 Like

I seem to pass all test cases and haven’t hard coded anything, but I seem to not pass validator 2, 3 & 4. No clue why. Can anyone help?

    int L = int.Parse(Console.ReadLine());
    int N = int.Parse(Console.ReadLine());
    string[] inputs = Console.ReadLine().Split(' ');
    int lowest = int.Parse(inputs[0]);

    for (int i = 0; i < N; i++)
    {
        int b = int.Parse(inputs[i]);

        if(b < lowest)
        {
            lowest = b;
        }
    }
    if(N%2 == 0)
    {
        Console.WriteLine(L - lowest);
    }
    else if(N == 1)
    {
        if((lowest) > (L - lowest))
        {
            Console.WriteLine(lowest);
        }
        else
        {
            Console.WriteLine(L - lowest);
        }
    }
    else
    {
        Console.WriteLine(L - lowest + 1);
    }

Browsed it and feel that the logic does not make good sense. For example N is even or odd is designed to determine the result which seems to be a source of error.

Im stuck, my code pass all testcase but fail validator 2/3/4 (what we testing here?);
Probably i miss something.

l = int(input())
n = int(input())
bots = []
maxDiff = 0

for i in input().split():
b = int(i)
bots.append(b)

for bot in bots:

if abs(l - bot) > maxDiff:
    maxDiff = max(bot, abs(l - bot))  

if n != 1:
print(maxDiff + n%2)
else:
print(maxDiff)

Someone suggested printing out some robots in the duct moving frame-by-frame, then enjoy the ascii cartoon. Some people can see something magical in the cartoon and thus problem solved. Quite an interesting idea to try out.

I made simple animation for this puzzle to visualize whats happening. Here is the link:
js bin - animation

2 Likes

I actually did that and well it was fun to watch :slight_smile:

Great puzzle!

1 Like

I do the same thing, … the first ‘>’ the second ‘<’ the third ‘>’ … ect
It’s not the good algorithme to do ?

maybe there is an easier solution globally thinking what happens in fact, they are so much clues in the forum that i don’t what to add …

This puzzle should’ve been put in a higher difficulty to put even more people off :grinning:

First doing big structures and simu, then asked myself why there is this flag “simplicity”.
Well, i added one line to the base code, no functions, that’s how simple this puzzle is. Paper and pen, and you get it fast. Thanks to this forum, which helped a lot showing me my complex simu was ridiculous XD

1 Like

You just need basic Mathmetical sense to solve this problem

Very bad tests case to me because I got 100% at the tests but only 50% at the validators

Hi @java_coffee_cup. What direction are the robots facing initially?, that’s the only part I don’t get in the puzzle. Thanks for responding :slight_smile: (in advance!)