Hi every one
“These lines draw a somewhat strange chess board that you fill with only two colours.” is the only definition of Morellet lines in the Morellet’s random lines puzzle https://www.codingame.com/training/easy/morellets-random-lines.
We are asked to tell if two points have the same color. How should I answer this question with the current definition? There is no clear rule in how the colors are chosen.
I managed to get 100% by assuming that two neighbor areas should not have the same colors. But it is clearly not the case even in the first google image results of “morellet lines”:
Maybe I missed something?
We just need to know, are the colours the same.
There are only two.
The points in one, or s+2*n, sector are the same color.
I tried to solve the puzzle Morellet’s random lines. I was thinking I successed because I passed all the tests in the interactive window but when I submit, he failed on the last one “Mind the sign”.
Is people have met the same anoying problem ? Or I messed something in my code ?
Thanks in advance for your help guys.
Maybe two lines are the same?
Hi nicola1, thanks for your answer
It wasn’t two same lines, it was two same intersection point from two different lines, that I count twice instead of once…
Have a good day
I have problem with Morellet’s random lines. All passed from ide but last one doesn’t pass. I see that someone had that issue, but can’t figure out how he solved it.
Why? Timeout or wrong output?
Sry, from ide all passed, when submitted last one didn’t pass so i don’t know exactly why it didn’t.
Maybe your algorithm is faulty.
I count all lines between two points (discarding same lines and those where points are on same side) and if that number is odd then NO, if it’s even then YES.
What if three lines meet at the same point?
It should be NO if there are 3 lines between points. If poins are on same side of one of those lines, it is YES.
-4 1 2 4
5 4 0
-5 4 0
-5 -1 0
-4 1 4 1
5 4 0
-5 4 0
-5 -1 0
Do you have idea what could be wrong?
you should consider case where you have one of a or b equal to 0.
In some odd way my code did’nt passed all test via interactive IDE.
BUT managed to get 100% in validation!
After, review some code from other member - I also found possible logical errors there.
Consider review an test cases.
Maybe your code is a bit faulty.
@UPS have you understood why your code failed the tests in IDE? To my understanding, you were lucky that your code passed the validators.
Maybe. But in this case validator tests are inconvenience. This code would not have passed the test.
More over: I carefully readed other solushion (only one published in GO). And found errors. It cant pass obvious test:
0 9 0 -9
0 1 1
So I conclude about wrong\incomplete tests on validator\IDE in this pazzle.
the last testcase (mind the sign) really troubled me a long time, till I finally know which part I ignored.
if you also passed all test but the last validator, try to focus on those lines may through the original point, and they also the same lines.
Can somebody explains the problem clearly? It is not understood at all from the description. How colors are defined? Some kind of image is helpful for explaining the example.