Ad
  • Custom User Avatar
  • Custom User Avatar

    I cannot understand why it's timing out. I think a minimized the calculations of factorials, and I have tried putting a lot sample tests, but those are passed. However, when I submit it times out.

  • Custom User Avatar

    As long as it's good in the end.

  • Custom User Avatar
  • Custom User Avatar

    shits happen... ;) (especially when coding XD )

  • Custom User Avatar

    OHH MYY GOOOD.. Instead of righting down I wrote false for some weird reason..

  • Custom User Avatar

    Yeah I just did the thing that I have read, not creating a Random object in a loop.. And I thought, okay no I didn't...
    Again with my ridiculous mistakes.. It's not correct though again.
    I am using Next(4) from Random. 0,1,2,3 is right, left, up, down let's say. Is that a right way to do it?

  • Custom User Avatar

    Well, pick one randomly (a direction), just as you're asked for? ;) (it's related to the ? command)
    Your code is run a lot of times and there is a statistical check that you effectively picked randomly a direction.

  • Custom User Avatar

    What are we supposed to do for the random direction test?

  • Custom User Avatar

    That's what I have been taught too, I just thought it was okay for something simple.

  • Custom User Avatar

    ok good.

    The thing you just learnt: global vars are evil... ;)

  • Custom User Avatar

    I have finally found out why the time out was happening.
    I used global static variables, for the stack etc, so it would work just for one example each time. So I've changed all to non-static methods and variables and does not time out.
    Now I will try and fix the failed test.
    Thank you for your responding even though it seems that there was nothing wrong with something but me. Thanks a lot though!

  • Custom User Avatar

    then there is 2 options:

    • either you're facing a "real" performances trouble, meaning your time complexity is too highg to solve the task and you'll have to change you're algo (...see foot note!)
    • or you're still in an infinite loop and you didn't print enough stuff to saturate the buffer before the time out.

    note: I hope you're not telling me that your ide "works fine with the example tests but not when clicking attempt"?? -> if so, keep in mind that the sample tests are just what they are called for...: SAMPLE ;)
    So your next move would be to get the inputs to see what the problem actually is.

  • Custom User Avatar

    How should I print out something?
    WriteLine() from Console does not print anything when it times out.

  • Custom User Avatar

    I'm sorry I don't understand what you're saying. But sounds like you're telling that you cannot get feedback when the tests time out on cw. For that, there is trick: print stuff to the console from inside your while loop(s) (whatever you want). If the time out is caused by an infinite loop, you'll saturate the buffer before the time out, this way, and so you'll be able to have feedback in the console. Up to you to disentangle what's wrong and where, from there.

  • Loading more items...