[Community puzzle] To Sky's Edge

This topic is about the puzzle To Sky’s Edge.

Feel free to send your feedback or ask some help here!

1 Like

That last test case is an algorithm killer.

1 Like

Hey, could really use some help in this one.
I been trapped in this strange loop that made me change my code over and over and over.

Basically my code gets stuck in a while() cause some vars remain 0 even when I refresh them every iteration.

Code if someone decides to help, sorry about the messy code (I was desperate and ruined it all)



Try using references instead of pointer for your Fe class, it will work way better. Here you had some pointers to pointers assignation used as copies, although they were not.
By doing this with your code, I obtained “62 62” for the first test, which seems closer to what you expect I guess :slight_smile:

How can I calculate the initial life expectancy?

Why not 20?

@AlexandreAguido, thats the problem!
The easy way is to check expectancies until you find all possible years. (Allways one min and one max, may be equal)

Interesting problem. Seems to be very sensitive to small adjustments. Got it working with all test cases except number 2. Maximum age I can get is 67. At 68 the population exceeds the limit.

Went back and read the instructions again. Things need to be done in a specific order. Well, some do, some don’t. Depends on implementation details. What finally got me over the hump was adjusting the ages and removing the dead from the total before checking to see if we had exceeded the limits.

Hmmm…Got all but the last one before submitting. Probably some fiddly stuff about when to check population against the limit, or whether kids are born before oldsters die. Then I failed variations of tests after submitting.

I’m new here, and held my tongue until running a few puzzles. Seems the instructions are generally not quite accurate enough. “Smaller” test cases are easy enough to check, and fiddle the code to make them pass, and figure out how to interpret the instructions. “Larger” test cases do not emit the full STDERR, so I must put this over to a computer where I can do real debug.

But this is a general observation.

I want to make sure that unit tests are correct, because all are passing except Large Span, where my result is 130 and wanted result is 120.

What is the answer of no 5 (large span)?
I get an answer of (56, 133) but the answer is truncated to
Found: “56 13”
Expected: “56 12”

The answer is 56 127 (as you can see when clicking at the list icon at the top right of your testcases).

The output of your program is compared char-by-char until the first mismatch is found, so the error message doesn’t show the complete output.

Hi, I got same issues like you,
be sure to increase ages BEFORE than calculate new-borns.

1 Like

I passed all tests, but keep fail the last case in submit. Any clue?

Oh, I see. Thank You.
I didn’t know that you could view answers.:sweat_smile:

I have a problem on Test Case 05, it gives me 56 133, instead of 56 127… and on submission only get 50% of cases.

Do you have any progress? I have the same results.

This exact same thing happened to me with my initial code. Here’s what my code did:

  1. Count number of fertile individuals
  2. Increase the age of the population
  3. Add numFertile / 10 babies to the population
  4. Kill off the elderly

Here’s what it SHOULD do:

  1. Increase the age of the population
  2. Count number of fertile individuals
  3. Add numFertile / 10 babies to the population
  4. Kill off the elderly

If you do these steps in the proper order, then you should get the correct answer. Also, depending on the language you are using, be careful of lazy evaluation of some steps. This can cause things to happen out-of-order even if you code them in the correct order. I ran into this with some of the LINQ in my solution.

  • danBhentschel

I solved all the test cases, but still can’t get the last validator.
Maybe someone could say what is his initial data - Years and Capacity?

I also didn’t really understand the logic of last text case.
It has 1 year of travel, capacity of 200, but the starting population is above 200. What I am missing here?
The only hope that “extra” people will die as soon as possible?