My submissions are getting rejected. What can I do?

Modified on Mon, 24 Oct, 2022 at 10:25 AM

If your submission is not accepted you have a bug in the program which is exposed by running it in Kattis. If you go to the submission page (click on the view details button) you can gain some additional information.
 
In case your program failed to compile, you can see the output from the compiler. In case the program compiled successfully, you will get the result of testing your program. You can see how many input files were passed, by looking at the line of boxes:
 
Screenshot_2019-05-26_at_11.05.12.png

 This example indicates that the submission passed the first 4 input files, but was rejected on the 5th input file. The following input files were not tried.

The first input file(s) are the sample input/output shown on the problem page. Getting your solution rejected on sample is usually an indication of a fundamental problem in your program, such as failing to follow the input/output specification by not reading from STDIN and writing to STDOUT, printing extraneous text not in the output specification (such as "Please input the first number:") or not exiting cleanly with code 0. Run your program like Kattis does (time ./your_program < sample.in > answer.out), inspect the exit code and make sure answer.out matches the expected output exactly, for example with diff.

If your program successful passes the sample input files it will be tested with a set of secret input files, which are designed to test different aspects of your solution, such as corner cases and large inputs. If your program is rejected on a secret input file it is an indication that you have a non-trivial bug in your program. It could also be that you fail to read any input and have hardcoded the sample data in your program, in which case your program will fail when it gets any data other than the sample data.

Typically, the easiest way to identify such a bug is to carefully consider the problem and generate your own testcases. You can use these testcases to verify the correctness of your solution and debug it. It's important to test both the extreme values allowed by the input specification, and any corner cases which may trigger bugs.

You can find additional information in the tutorial for each language in the Kattis help, this help database, as well as in the "How judging is done" section.

Note that we do not share any additional information regarding the content of the secret testcases, or details of running your code on them (beyond the result). We can not help you design or debug your solution so it is accepted by Kattis.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article