royappa's blog

By royappa, history, 6 years ago, In English

Any general ideas on how to debug RUNTIME_ERROR on huge inputs in the systests? Here's my submission: https://mirror.codeforces.com/contest/1092/submission/47535638

  • I cannot copy the full input (it is truncated with "...") for local testing with gdb
  • I tried compiling with execinfo.h to use a stack backtrace handler, but that doesn't compile (no surprise)

My code gives RUNTIME_ERROR on test #7 and both times it says memory used is exactly 10000KB, but the memory limit is 256MB. It does seems odd that the crash would come at that exact point of memory (and both times).

Thanks for any tips on what I'm doing wrong. Not asking for algorithm help, as I have read the editorial. Just trying to implement.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

i recommend just doing random test. Your program seems to crash on this examples:

14
1 0 0 1 0 0 0 0 1 0 0 1 0 1
10
1 0 0 1 1 0 0 1 0 1