gamegame's blog

By gamegame, history, 5 years ago, In English

https://mirror.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 :))

  • Vote: I like it
  • +32
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +37 Vote: I do not like it

Honestly I have seen such post from only greys and greens

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it +64 Vote: I do not like it

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

»
5 years ago, # |
  Vote: I like it +7 Vote: I do not like it

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

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

    you can also help me sometimes in your free time.

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

    You are not red as gamegame said. gamegame only wants answers from trusted individuals.

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

    I realised that my arrays weren't big enough. I resubmitted and it still got the same verdict. Hmm, i thought this would only get runtime error. That's interesting to know.

»
5 years ago, # |
  Vote: I like it +23 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

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

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

      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 years ago, # |
Rev. 2   Vote: I like it +198 Vote: I do not like it

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

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

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

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

    change the first line to <= yellows and it is more realistic

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

    What would happen when tourist would say the same. HaHa.

»
5 years ago, # |
  Vote: I like it +35 Vote: I do not like it
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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 years ago, # |
  Vote: I like it 0 Vote: I do not like it

"Idleness limit exceeded on pretest 8"

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

»
5 years ago, # |
  Vote: I like it +41 Vote: I do not like it

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

»
5 years ago, # |
  Vote: I like it +10 Vote: I do not like it

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 years ago, # |
Rev. 2   Vote: I like it +37 Vote: I do not like it

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