hkbishwa's blog

By hkbishwa, history, 6 years ago, In English

Hello, codeforces community!

I am recently working on a project of building a Online Judge using Java and my minimum target was at least to make sure that it can detect the four most popular verdicts in Competitive Programming world. I somehow managed to implement AC, WA, TLE. But I am at a loss how to handle Runtime Error. For most of the cases, my program takes RE as TLE. I am just curious to know how can one determine Runtime Error effectively. I would love to have some idea about it and which can be a better a platform than CF community!

Thanks to all in advance.

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

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

Check the return value of the process. If it is non-zero, it is RTE.

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

    Thank you. I tried it but for a c code with a simple 1/0 statement it took 40 sec to terminate and return a non-zero value :(

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

When a runtime error occurs the output will be null. So check if the output is null or not. that's it.

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

    I'm afraid I could not get the meaning of "output" in your comment. what did you mean by output? Can you please elaborate ?

    If you mean by "output" the output of the program submitted by the client against judge data, then what about the case when the code will get a TLE? Because in this case the output will also be a null, I think. Am I right?

    Please clarify :D

»
6 years ago, # |
  Vote: I like it +1 Vote: I do not like it

If you are in Linux and coding in python, you can use this script: https://ideone.com/jHoSRD
It can handle all the things. (observe from line 42).

»
6 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I have no much experience in this but you can do it by trick First check for TLE then terminate the program and check for the output because most problem doesn't exceed 15 second