What does 'subtask' mean in a question in competitive programming . I solved a question whose logic was correct ( as I crosscheck ed my output with theirs) and it should not give any errors. But when I uploaded it...it showed wrong answer. It showed an error something related to subtask. In the question itself there was a mention of subtask but I could not comprehend it.
Asked by: Soumyodeep_Dey on April 7, 2019, 6:34 p.m. Last updated on April 7, 2019, 6:34 p.m.
The code you submit on any online judge( Codechef, Hackerrank, etc) are run on multiple input data(test files). Each of these input data are stored in seperate files which form a subtask.
The example (sample) input/output provided with the question is provided just for explanation purpose. Getting your code to run on the sample input and getting results as in the sample output doesn't guarantee that your code is correct.
When you submit, your code is run on large no of test data. So during this step you may get a wrong answer if your code is not producing the desired results, implying that your logic is incorrect.