Блог пользователя gamegame

Автор gamegame, история, 5 лет назад, По-английски

https://codeforces.com/contest/1185/submission/55779719

I'm getting ILE and i don't know why.

My code doesn't work on this test.

I tested it a lot of times and it works

LGMs and reds pls help :))

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +37 Проголосовать: не нравится

Honestly I have seen such post from only greys and greens

  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +64 Проголосовать: не нравится

    I believe that he wants an explanation for the Idleness Limit Exceeded verdict on a NON-INTERACTIVE problem, which is highly irregular.

»
5 лет назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Probably, it is because of undefined behavior in your code. Try to run it with valgrind or similar.

»
5 лет назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

When I run it locally i also get ILE. The problem seems to be that you made the add function return an int but you don't have a return statement in it and you don't use the return value; changing it to void made it work.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    what, scanf also has return value. i think this is not the issue

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Well, you have no return statement in the add function. Though on cf it still doesn't work after changing the add function; only locally.

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +198 Проголосовать: не нравится

<=greens: 'debug this code' --> negative contribution

blues and purples: 'debug this code' --> actual answers

IGMs: 'debug this code' --> CF admin response :o

»
5 лет назад, # |
  Проголосовать: нравится +35 Проголосовать: не нравится
if(g==1) add(dp[j][a+1][b][c],dp[j-ti][a][b][c]);

You're trying to access index 16 when your array is dp[226][16][16][16].

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes, but i was surprised that this would make the program fail to detect a runtime error. I thought this would always return RTE

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

"Idleness limit exceeded on pretest 8"

I have never seen a solution have this outcome, ever. What is this ?

»
5 лет назад, # |
  Проголосовать: нравится +41 Проголосовать: не нравится

If you used Java, you wouldn't have these problems.

»
5 лет назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

If you use g++, you can compile with the following options.
It helps you to catch undefined behavior when you test locally.
g++ -fsanitize=undefined a.cpp

Learn more here

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +37 Проголосовать: не нравится

Plot twist- a grey guy hacked a red guy's account so that he can ask doubts