moji's blog

By moji, 12 years ago, In English

Hey all! The problem doesn't look much difficult, It is easily reduced to a knapsack problem. But I got a strange problem with it! the code below gets: Idleness limit exceeded on test 9 The code: http://paste.ubuntu.com/5673644/ I've shown my problem to some people but no body understood what's the problem. CAN ANYBODY HELP!!!!

  • Vote: I like it
  • -8
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I think your code has problem... I get accepted so everything with CF is ok... But aslo I can't find any mistakes in your code ...

»
12 years ago, # |
  Vote: I like it -21 Vote: I do not like it

سلام شما که خفنی اکسپت گرفتی می تونی تست غلط برا کد ما پیدا کنی؟ اگه حوصله داری، وقت داری، تستر نوشتن بلدی... البته خوبه اگه بلد نیستی یاد بگیری برا م۳ خیلی خیلی کمکت می کنه

»
12 years ago, # |
  Vote: I like it +4 Vote: I do not like it

I don't know. But I just submit your code using MS C++ compiler and it gives me verdict Wrong answer. Pretty Strange ..

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

strange! I replaced all "int" to "long long" and my code got AC! where do you think the problem was?

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    When u see print result modulo a nine-digit prime number (1000000007), in case your variables do not overflow, take them long long (maybe it needs BigInteger!).

    • »
      »
      »
      12 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I did; but not about all of my variables. just for the one's which could overflow!

  • »
    »
    12 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I once got idleness limit exceeded verdict due to the problem with array size which i think should be Runtime Error. Here due to the overflow of some variable, if you use that variable for accessing array elements your code may access some negative index. Though i am not sure this may be the reason of getting this verdict. If you learn the true reason behind this verdict please let me know. :)