https://www.codingame.com/training/medium/lumen
Send your feedback or ask for help here!
Created by @Sceurpien,validated by @bbb000bbbyyy,@Alain-Delpuch and @DEIZ211.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/medium/lumen
Send your feedback or ask for help here!
Created by @Sceurpien,validated by @bbb000bbbyyy,@Alain-Delpuch and @DEIZ211.
If you have any issues, feel free to ping them.
Hi,
Lumen was a nice Puzzle to solve.
I had to test until L = 6 to pass the final submission (Medium Hall)
Maybe βMedium Hall - Intense Lightβ could be a better title for this test
Anyway, cheers!
Seriously, this is an easy puzzle?
Yes, even if I solved it with a BFS, you can solve it in a few lines in Python.
Hello!
I have finished the puzzle with success on all test cases.
However, after I submit the code, two of the post validations fail, saying that I have hard-coded values in it. I am pretty sure I do not have any.
Can someone help me with this to figure out what is wrong?
Weβll need more information for us to help you mate
Which validators ? Might explain a little your algorithm etc⦠!
Youβre right, so the post tests that fail are No 5 - THEY have a medium cellar and
No 6 - THEY have a large cellar.
As for my code, I create a table of objects (with properties like HasCandle and LightIntensity). Then I have a loop on those objects and a function to change light values on the surrounding blocks, if the current block has a candle.
All test cases are a success. On post validations only the 5 and 6 are a fail but cannot seem to understand why.
Is it recursive ? You might have an overflow ?
It is not recursive.
Can I show you the code?
yep send via private message !
Here is part of my private answer to @KainV in private message. it could help some :
L is not always equals to 2 or 3. it could be 1 it could be 9β¦
for example in my code i do something like this:
recursiveFunction(cells, i, j, lightPower) {
cells[i][j] = lightPower;
if lightPower <= 1
stop here recursion
if i is in cells bounds and if the lightpower in the cell is < than the current light minus one
recursiveFunction(cells, i(-/+)1, j, lightPower-1)
if j is in cells bounds and if the lightpower in the cell is < than the current light minus one
recursiveFunction(cells, i, j(-/+)1, lightPower-1)
if i and j are in cells bounds and if the lightpower in the cell is < than the current light minus one
recursiveFunction(cells, i(-/+)1, j(-/+)1, lightPower-1)
}
In order to check like this around the cell :
βββββββββββββββ
β \ ββ | ββ / β
βββββββββββββββ
βββββββββββββββ
β β ββ β ββ β β
βββββββββββββββ
βββββββββββββββ
β / ββ | ββ \ β
βββββββββββββββ
Good luck !
I have the same problem as KainV
This is my first script in Python and I canβt make it work
Iβll try with another language
According to the constraints
0 < L < 10
Yes my bad, all I was saying is that L is variable ! ^^
You might want to explain a little your problem / your algorithm ?
EDIT : I edited my previous post !
Thanks for asking but I just submited my code in JavaScript and I scored 100%
Letβs fix Python version
EDIT : Fixed. Looks like I forgot +1 in range()'s stop argument
the sentence βIf a spot is touched by two candles, it will have the larger βlightβ it can haveβ was confusing. I assumed it meant that if a spot has 2 or more neighbouring candles it would get the light level of a candle. In testcase 2, the X right in the middle of the matrix, between the candles, has a light level of 2 and not 3.
I solved it without any consideration for light level.
Same thing here. works great, have everything in variables, fails those same two tests on submission.
I had the same problem with the 5 and 6 test. As a result, it turned out that I was going beyond the bound of the array.
Same problem here with 5 and 6 at the validation. I m not sure to understand correctly the part about light when there is two or more candles. to be sure to understand. What is the results with the following inputs? my solution give 5 but i wonder if the correct answer is 0β¦ if so, a test case should be added.
l=4
n=5
XXXXX
CXXXX
XXXXX
CXXXX
XXXXX
consider this :
With light = 6
CXXXXXXC
65433456
instead of
CXXXXXXC
65432106
When two overlap, you have to keep the highest light value
Right from my code :
X X X X X
C X X X X
X X X X X
C X X X X
X X X X X
----------
3 3 2 1 0
4 3 2 1 0
3 3 2 1 0
4 3 2 1 0
3 3 2 1 0
----------
5