Doctor Who - The Gift puzzle discussion


#1

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


#2

Just a quick feedback on “the Gift”: I had the feeling that it was significantly easier than the other medium puzzles. It is often difficult to determine how “trivial” an algorithm is, because it is a matter of experience, training, or just luck to find the “right” way on the first attempt. Yet, for this one, the first thing that came to my mind (sort and print minimal budgets until the rest can be shared among large budgets) happened to be a 10 minute / 20 lines of C++ code / 100% solution. Does the order of puzzles is meaningful? If yes, this one might be moved among the first ones.


#3

I concur. I found it really easy and had it working in like 5mn, although I used a completely different approach (from smallest to largest, always assign the remaining mean, or as much as possible).


#4

I pass all tests (even the test Impossible) but when I submit my code the test Impossible does not pass. I don’t understand why.


#5

The exact same thing happened to me :frowning: maybe the test Impossible is not exactly the same when we submit our code…


#6

Continuing the discussion from [Doctor Who - The Gift puzzle discussion]

EDIT: nope, talk about the puzzle in the appropriate puzzle topic, don’t create an unnecessary long title either please


#7

Hi,
System tests are not the same tests as presented to avoid hard coding of solutions.
If your code not pass a test, your code is not optimized for all situations “like” the situation tested.
Try to optimize your code.


#9

I had the same problem with the TEADS problem.
In fact, my solution was buggy. I edited it, now it’s 100% validated.


#10

NO DAMN FULL CODE

here is my solution.can some1 tell me what is the problem here


#11

O_o
Your solution is far more complicated than mine.


#12

i got strange bug here: my code did not pass test #8 “Several solution fast” from ide window, but 100% tests are completed on submit somehow
checking my code…
yep - after some rewrites i passed all tests before submit, but i think there should be achievment for this :smile:
seriously, if you have different validation tests before submission and after it - you should expect reverse results sometimes


#15

Why my solution passes all test exept “big random”?

Edited: No full code even in png :smiley:


#16

i suppose this is due to rounding / division errors, no need to use division in this task:
Edit : No full Code


#17

Potential error with Test Case 3.

Input provided by automated test case is 1, 100, 60, with result 1, 49, 50. I think there is a typo with 60 and it should read as 100.

Thoughts?


#18

The input I am seeing is
3
100
100
1
60.


#19

I got all of the tests running except the last one ‘Big Random’. When writing debugging system prints, I’m learning that the program is cutting off a part of my ArrayList (implemented with Java). I would store all of the 85614 numbers in an ArrayList to work with. Printing out this ArrayList shows the number fine, but immediately printing this list again, without any other code in between will list only a handful of numbers, all in the [160;164] interval. So essentially, it cut off a huge part of the list from the beginning and only saved about 30 or so at the tail. I’m assuming I’m working with memory constraints here then?

I find it weird it would store the values in my ArrayList fine and show them correctly when I print them the first time, but upon printing them out again immediately, it would return a shortened version.


#20

Changing them into an array worked fine. Weird.


#21

Why by input :
3
100
100
1
60

the system expects :
1
49
50

I think the result should be :
39
1
60

?


#22

So, yeah, I also built a way to do it very quickly, but I got a very strange bug with the last testcase “big random”. At some point, where the participants were spending 70, one of them spent 69 (based on my calculations). I couldn’t find a way to get an idea of what was going on, so I applied a patch so ugly my own momma would slap me silly:
if( uCurrentSpending < uLastCurrentSpend )
{
uCurrentSpending = uLastCurrentSpend;
}
Now it’s eating me alive…


#23

IIRC, I found the ceiling function useful. Or the floor. One or the other.