[Community Puzzle] A Coin Guessing Game

https://www.codingame.com/training/medium/a-coin-guessing-game

Send your feedback or ask for help here!

Created by @Niako,validated by @dwarfie,@JBM and @java_coffee_cup.
If you have any issues, feel free to ping them.

I’m not sure I understood the “coins ring” thing; why not just say the “unique solution” part?
Is there a subtility I didn’t get, or does this aim to give an insight of the problem?

It was only meant to hint that a certain strategy you might easily think of will indeed work.
It is indeed actually implied by the fact that the solution is unique, but I assumed it was not that easy to see or prove.

2 Likes

Is there something special with validator 5 ? I’ve passed all IDE tests and all validators, except this one.

Nope, nothing really special. Maybe check your code twice.

thx for the reply

Validator 3 fails for me although all tests pass. Another problem where you can’t get 100% unless you can guess how to trick the validator. I won’t waste any more time on this one.

Well, apparently I’ve solved more than 500 puzzles on CG and I’ve never had to trick the validator. The only trick I know is to write an algorithm that actually solves the problem.

3 Likes

The tests and validations should be consistent; the validations should not cover types of inputs that are not covered by the tests. I know that may not necessarily be easy to do for all problems, but otherwise people might have to somehow make their own tests to make sure their code will pass all of the validations.

I would recommend making validation cases 3 and 5 additional test cases and coming up with four additional validation cases.

I know. They are consistent.

Here are a few additional cases in the style of test and validator 3.
4 3
2 1 7 3
5 6 8 3
4 8 1 5

SOLUTION:
6 4 2 8
4 5
1 5 3 4
2 7 6 8
3 4 2 1
6 8 7 2
4 5 3 8

SOLUTION:
8 6 2 4
4 2
5 1 6 8
3 4 1 6

SOLUTION:
2 8 4 6
4 10
5 3 8 1
4 8 1 2
4 2 8 1
6 2 4 8
2 6 4 8
3 8 1 5
3 5 8 1
7 5 3 1
1 5 3 7
5 7 6 4

SOLUTION:
6 4 2 8
Here are a few additional cases in the style of test and validator 5.
10 6
18 14 19 1 11 9 17 13 5 3
3 18 12 11 6 7 19 10 16 1
5 2 8 13 18 9 20 7 3 6
7 3 6 20 5 18 19 9 12 2
14 17 19 18 11 1 3 16 5 13
8 7 1 5 4 12 6 16 20 18

SOLUTION:
2 4 10 14 16 20 12 18 6 8
10 6
13 6 20 9 1 5 11 12 7 3
1 15 10 3 18 20 12 13 7 4
6 7 8 5 9 11 1 12 14 20
4 17 1 6 18 8 16 10 12 14
13 15 12 7 4 2 18 20 3 9
8 15 3 12 11 17 2 7 9 18

SOLUTION:
2 14 18 16 10 4 8 6 20 12
10 6
11 19 5 12 6 1 9 7 18 3
15 6 1 3 7 4 16 10 8 13
8 4 10 17 14 20 12 1 18 16
11 5 8 9 2 18 14 6 12 3
6 13 10 19 3 12 1 5 9 14
4 1 14 20 5 18 6 8 11 12

SOLUTION:
2 20 16 14 4 10 18 12 6 8
10 6
20 2 19 17 13 12 14 8 5 10
7 2 16 12 6 8 18 10 19 11
9 18 5 19 10 12 8 20 14 16
4 12 18 2 16 7 8 10 11 5
7 15 1 5 16 19 2 18 10 20
16 2 12 3 5 4 20 14 13 15

SOLUTION:
12 10 6 14 2 20 18 8 16 4
1 Like

@Niako : thank you for this additional cases, but unfortunately my code pass all this tests too and not validator 5.

@Nouanda Ok, I answered in PM to avoid spoiling here.

1 Like

This was substantially easier than the previous minesweeper event. Thanks for the awesome puzzle @Niako, I had a blast solving this one!

3 Likes

The additional test cases like validator 3 all worked, but not validator 3. There is something different about validator 3 compared to the test cases.

I did solve the problem by rewriting one section of my code.

Very pleasant puzzle with with gentle difficulty, good job !

2 Likes