https://www.codingame.com/training/medium/fractal-image-recognition
Send your feedback or ask for help here!
Created by @CSGO_BOT,validated by @DaNinja,@Smelty and @KAbel.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/medium/fractal-image-recognition
Send your feedback or ask for help here!
Created by @CSGO_BOT,validated by @DaNinja,@Smelty and @KAbel.
If you have any issues, feel free to ping them.
The stub is faulty: It reads βimageSizeβ chars per line, but input contains twice as much because of the separating spaces.
I think the best would be to just read it cell by cell:
loop imageSize loopline imageSize pixel:int
I donβt understand these instructions,
" To place a fractal to the north (β3β) of pixel P , pixels β9β, β5β, β3β, β4β, β2β around pixel P must be empty.
To place a fractal to the northeast (β4β) of pixel P , pixels β5β, β3β, β4β, β2β, β7β around pixel P must be empty." .
When I put the northeast(β4β) of pixel P (for the first extremum (1, 6)) , the fractal in the north (β3β) canβt be empty 'cause there will be near each other (north and northeast) of the extremum.
And in the place of the result example, why we hadnβt :
0 0 0 0 0 5 3 4 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 1 1 0 0 0
0 0 0 0 1 0 1 0 0 0
0 0 9 1 0 0 1 0 0 0
0 0 8 6 7 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 8 6 7 0 0
Because you also need to have
at least 5 consecutive empty (β0β) spaces around it.
For example, the 5 youβve placed at the top has only 4 consecutive empty spaces around the 1 pixel, so the 5 cannot be placed there.