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

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

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 :))

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

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

Honestly I have seen such post from only greys and greens

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

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +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.

»
7 лет назад, скрыть # |
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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +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].

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

"Idleness limit exceeded on pretest 8"

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

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

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится +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

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

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