[Community Puzzle] Let's Go To The Cinema!

https://www.codingame.com/training/medium/lets-go-to-the-cinema

Send your feedback or ask for help here!

Created by @TBali,validated by @bbb000bbbyyy,@sammck and @java_coffee_cup.
If you have any issues, feel free to ping them.

Can anyone give me tips, what should I test my program with, if I only fail Bigger cinema testcase/validator? The data there is too big for me to manually check the partial results. I pass every other test and validation.

In the Bigger cinema testcase my program gives “66 2040”, and the result should be “66 2043”.

Hi, Your solution is so close to the right one, that it might be some obscure edge cases.
To help, I uploaded the correct seating after running test case 08 (big cinema) here:
https://www.aviationfanatic.com/cg/cinema_test08_log.txt
In this textfile the numbers show for each seat, which group the occupant is coming from.
I suggest to create similar error log from your code and compare results.

1 Like

Hello.
Thanks, this helped a lot. I shifted left until the end and I only tried shifting right after this failed to find enough empty seats; instead of 1 left 1 right.

Nice puzzle, but it took me way to long to understand why my code passed all the tests but the small/big cinemas. In the end I realized we don’t have the same natural understanding of front and back in the description.

If unsuccessful in the row, then try 1 row towards the front, then by 1 row to back, 2 rows to front, etc.

You should clarify that the front is towards the top of the theater, not the bottom :slight_smile:
Also as mentioned earlier, debugging this puzzle on small/big cinemas is really tedious.

Thanks for the feedback, I am happy to hear you solved my puzzle!
I wouldn’t have thought that ‘front’ cannot be understood as in ‘front of the screen’, but I am not native-English. I put in the input section “The 0 0 seat is the leftmost one, immediately in front of the screen.”
(Unfortunately the png picture example is too small to help in clarifying this.)

Regarding hard debugging for big cinema: You are absolutely right, I did not find a good way to mitigate this and was not sure how big the output can be, that’s why I chose in the end not the expect the full cinema layout as the puzzle output from players, only these 2 counters. There is a log output for large cinema in the forum thread as some limited additional assistance.

One way would be to create more small tests/validators to cover everything you can think of (including my front/back problem :slight_smile:). The small/big cinemas would simply be some kind of light stress tests after that.

hey, i love this puzzle,
i try to finish it for a long time but still don’t pass the small and big cinema
small cinema: 9 72 instead 9 75
bigger cinema: 66 2037 instead of 66 2043
is it possible to have a trace debug for the small cinema ?
thx

Here is my debug output for ide test ‘Small cinema’ after the last group got seated:

Cinema: 19 rows, 10 seats per row.
  total groups / persons: 33 / 190
  groups / persons seated on the right place: 9 / 75
  groups waiting:  <none>
  seating (group IDs): 
       5   5   5   5   5  28  28  28  28  28
      17  17  17  17  17  17  17  17  17  32
      32  26  26  26  26  26  26  26  28  28
      31   7   7   7   7   7   7   7   7  31
       4   4   4   4   4   4   4   4   4  31
      30  30  20  20  20   6   6   6   6   6
      24   0   0   0   0   0   0   0  30  30
      18  18  18  18  18  18  18  18  29  29
      31   8   8   8   8   8   8   8   8   8
      23  23  23  23  10  10  10  28  28  28
      14   3   3   3   3   3   3   3   3   3
      13  13  13   2   2  16  16  16  16  30
      31   1   1   1   1   1   1   1   1   1
      15  15  11  11  11  11  11  11  11  31
       9   9   9   9   9   9   9   9  29  29
      29  29  29  29  12  12  21  21  21  21
      31  19  19  19  19  19  19  19  19  19
      22  22  22  22  22  22  22  22  22  22
      27  27  25  25  25  25  25  25  25  31

Maybe you handle a border case a bit differently than in the statement. E.g. the order of seat finding is important, the sequence is 0, -1, 1, -2, 2, -3, … for both the columns and then the rows. (This is the delta from the starting point).

2 Likes

thx a lot @TBali ! it works… i was not browsing all the available places for the rows… :’(
So happy to get it, i will try to simulate it visually !