BrendonSlash's blog

By BrendonSlash, history, 9 years ago, In English

http://codeforces.com/contest/257/problem/C

For the above problem I am getting a runtime error.

This is my submission http://codeforces.com/contest/257/submission/13480280

The test case is too large hence I am unable to debug it.

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

»
9 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Here is a nice strategy that might work with these large test cases.

If you really cannot come up with what is wrong with your code, and then you check and find a very large test case..Open up any accepted submission, and try all small test cases on Codeforces and not your PC ,if you are using C++.

Most probably you will find the bug causing the RTE if something is really wrong with your program, if all of them pass ( and you found like 5-10 test cases), your program is usually right, but you should be using more memory, or maybe just an error out of bound exception..If you lose all hope, write it in JAVA, codeforces will tell you the exact exception being thrown. (RTE reason).

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

Probably acos() is the one to blame, it's domain is [-1, 1], any other value would cause domain error. You use it with doubles, and being trustable is not what this type is known for. I don't find anything other than that suspicious.

»
9 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Comparators don't have return statements for one of the cases. That causes undefined behavior.