https://www.codingame.com/training/medium/flood-fill-example
Send your feedback or ask for help here!
https://www.codingame.com/training/medium/flood-fill-example
Send your feedback or ask for help here!
Hi everyone,
Iâm succeeding everything but the 4th validator. Any idea what it could be?
Cheers.
I had a same problem with you. It may be you need to think that the tower can have same I.D. as puzzle said. That means you should distinguish the towers even if I.D is same. I misread description and spend a hour to figure it out.
Ooooh⌠sneaky rule, good point, thanks a lot!
But Test 4 Also has Different towers with same ID
Yes, That is same ID, but not in same distance
I find the rules quite unclear on two points:
Your 1. is very clear, thereâs no mention of floodfill at all except in the tag. Itâs all about âclosest towerâ, so it can be defined for any spot.
I agree with your 2., itâs not very clear and you discover it only with test 5. Iâll try to edit to make it clearer.
I donât understand why at time = 2 there is not a + in (2,1) , since b and b arrive at the same time. (same (4,1) and (2,3)). Thanks
Which case?
In example :
Consider the following grid:
...#.
A#...
#..B.
.....
At time = 1, they will reachâŚ
A..#.
A#.B.
#.BBB
...B.
At time = 2, they will reachâŚ
AA.#.
A#BBB
#BBBB
..BBB
if you are :
.B
BB
why
BB
BB
and not
+B
BB
?
Because B is only one tower; the purpose of the flood fill here is to mark the coverage of that tower, it is not to grow more towers. Compare with test case 5, where there are two towers A.
Sorry but I do not understand. I saw case n°5, but I donât see the difference.
The rule stated by the statement is that âIf 2 towers can reach a spot at the exact same time, mark that spot â+â, even if both towers share the same I.DâŚâ
Tower B is just one tower, so it does not fall within the scope of the above rule.
But in test case 5, there are two towers both named A. âTwo towers sharing the same I.D. of Aâ fall within the scope of the above rule.
In short, you count the number of letters in the input data (the initial state), and that is the number of towers you have to deal with.
And if you are still confused, remember that you are converting a map of towers into a map of tower coverage. The flood fill does not indicate additional towers (there are NOT tens of towers of the same I.D. on the map!); the I.D.s on the map you have to output merely show which tower covers each spot.
ok, thanks, iâm starting to understand the problem. I canât see how to solve it yet but Iâll think about it and come back if I canât.
I got it ! Thank you for all your advice.
can someone explain why thereâs +
in (6,4) in test case 2? the 5
tower can reach (6,4) at time = 6, the 2
tower can reach (6,4) at time = 5
#....##..#.#
#.#..#..5..#
...#........
......##....
......#..#..
1...........
............
.#.2#.......
...#..3.#.#.
....#.....#.
....#.....#.
...4...#....
Not sure which cell youâre referring to as (6, 4). Would you please edit your message and mark that cell using another character?