[Community puzzle] Timer for Clash of Code

Thanks for the help :slight_smile:

I had the same issues as you CodinBros; my issue was with the case where the input time was within 10 seconds of 256 (4:16). Try debugging your output and manually setting the input time to some values in that range to see what your output is. The edge case issue became clear once I did that.

4 Likes

oooh thats a good point so my code return 0:4 instead of 0:04 if there are less than 10 seconds left

This was my issue; needed to pad the seconds if <10. Thanks.

Many thanks!! My code wrongly displayed 0:9 instead of 0:09. I pass it. Thx

Thanks, my mistake! :slight_smile:

Never mind.

Hello everyone first test fails after submitting even if my result matches with the expected one. IDE told me the solution was correct.

I have added a new test to the end of the suite, called ā€œDown to the last secondsā€ so that others donā€™t stumble over this in the future.

  • danBhentschel
1 Like

Thank you. Iā€™ve been fighting this for weeks. Never crossed my mind that the formatting was off.

Terrible problem definition.

The time reference is based on a timer counting backwards. Itā€™s not a date, just the count of a timer.
The explanations refer sometimes to an absolute time, sometimes to this floating reference.

ā€œthe timer changes based on players joiningā€ is plain wrong. The timer keeps counting toward zero regardless of people joining. What changes is the date at which the game might be started (what I call the ā€œrush dateā€ since it can only make the game start earlier).

I especially wondered at this ā€œset the new time instead of starting the gameā€ directive. I have no idea what that means so I simply ignored it. Luckily for me it didnā€™t seem to matter neither for tests nor validation.

The tests send you timestamps corresponding to players joining after the game started, as if people could join in mid-game or something. There is not a word said about this in the problem definition.
When that occurs, the rush date has no longer any effect, obviously, but if you still take it into account youā€™ll most probably produce a wrong result (as if this player joining late had delayed the game start).

3 Likes

Agreed, the problem is nice, but the explanation is really confusing, some sentences are useless ("If a player joins at the same time the game is supposed to start, set the new time
instead of starting the game.ā€), some other are confusing (ā€œp is the number of players in the roomā€, yeah, but itā€™s the number of player in the room before the player join, the explanation leads to believe itā€™s including the current player), maybe somebody could rewrite it ?

1 Like

The problem is fairly straightforward; the hard part is understanding the ambiguous description:

  • does ā€œcurrent timeā€ mean the time since the timer started, the time until the game starts, or the time currently displayed on the timer?
  • is ā€œpā€ the number of players in the room before or after the player who is joining?

Most importantly, the purpose of a timer is to count down to when the game will start. If the game starts before the timer reaches 0:00 then the timer is BROKEN! (unless 8 players join)

The challenge of a puzzle should be finding a way to implement a solution, not struggling to understand the badly-written spec.
HATED IT!

2 Likes

I have a problem :frowning: I passed all the test in C langage but the fonction malloc canā€™t found enough place sometimes so my rate when i send my code depend only of this. With the same code, i can get 33% and next a 58%ā€¦ How can i solve this?