[Community Puzzle] 1000000000D WORLD

https://www.codingame.com/training/easy/1000000000d-world

Send your feedback or ask for help here!

Created by @awnion,validated by @tutubalin,@codybumba and @SelrahC-Twin.
If you have any issues, feel free to ping them.

Hi! Cool puzzle, I’m enjoying it so far. :slight_smile:
Although I think my solution is correct and I have tested it over multiple cases, I don’t find why I’m failing Test 5 (and Validators 3 and 5). I don’t get what makes these specific tests so special. Do you have any hint?
Thanks!

2 Likes

You are probably using int instead of long :slight_smile:

4 Likes

Nope, I’m really using long but thanks for your answer! :slight_smile:
EDIT : you were right!! I was using long to store the result but I also needed to use long to store amounts and values of the differents pairs in each vector. Thanks! :slight_smile:

1 Like

Hello !
I’m a bit confused, I passed all the tests and validators but validator 6 ! I read again my code to try to understand where was the mistake but I can’t figure out what’s wrong… Does the validator 6 have something special ?
Many thanks in advance !

Nothing special really, just make sure your code can handle negative numbers correctly wherever they are :wink:

1 Like

Thanks for your answer !
I missed a condition, I wrongly assumed I was at the end of a sequence at some point… Weird that my code passed all the tests…

1 Like

I have passed all the tests adding the products of the elements one by one.
[1000 1] * [1000 1] = 1*1 + … (1000 times)
You should have a performance test that would fail on such an algorithm.

1 Like

Pretty sure that cannot be done due to size reasons. You have only 256MB of heap which will not allow for more than 4 million numbers; Now halve that for 2 arrays. Now halve if again because on some languages like JS the array are keyed and you have to store both the key - which are numbers and the values.