Doubt regarding subtasks

Subtasks

100% points - Original constraints
what is the meaning of this while solving problems for example in this problem
SUMPOS Problem - CodeChef Constraints are x,y,z so what does that mean should i solve the whole program using only these varaibles?

“100% points - Original constraints” this line indicates, the problem only has one subtask(so 100% points will be awarded if you solve that subtask), and the constraints of the variable in that particular subtask is equal to “Original Constraints”, which means the one that is mentioned under the constraints (1<=x,y,z<=1000). It could have been the case when there is more than one subtask, then the subtask with some lower points may contain some lower range values, using which the problem is easier to solve.

thank you for the reply but still I am not clear …like do i have to make any changes in program like I can use any number of variables ?What does this subtask relate to the program Why is it given

I am not sure about your question regarding the “number of variables”. But I can answer your question on “How subtask relates to a problem”. See, the difficulty of a problem is not always judged by only the problem statement or what task you have to perform, it is also determined by what constraints the given variables are taking. In short, the stricter the constraints, the more efficient program you have to write for getting your solution accepted. For example, if a problem is divided into two subtasks such as 10 points + 90 points then your brute force method may pass the 10 point subtask but will fail the remaining 90 points, so you need to optimize your code a bit more to get full points.

I get it what subtask is and how it works but my question is what is this “original constraint” subtask

if you know what time complexities are, this might help you understand.
suppose there is a question that has 3 ways to solve, and a time limit of 1s.
the 3 ways could be a brute force in O(n^3)
a slightly optimized brute force in O(n^2)
and a dynamic programing solution in O(n)
your original constraints ( which are given in constraints section, and look something like this :
1 <= T <= 10^5
1 <= N <= 10^5
sum of N over all test cases <= 10^7 etc) will therefore define which of these solutions work;
for eg, if you take 1 <= n <= 10^7, only the O(n) solution will get accepted.
in this case, 2 other subtasks can be given, namely 1 <= n <= 10^4, giving 10 points. This will allow the O(n^2) to execute in under 1s
and possibly another subtask(if the author is feeling generous), 1 <= n <= 10^2, allowing the O(n^3) solution to also be accepted, and awarding 5 points.

In this manner, if your solution is the O(N^2), you will get both the subtasks 2 and 3, so 15 points.
if the solution is O(N^3), you only get subtask 3, so 5 points
and if the solution is O(N), you get all tasks and therefore get 100 points.

NOTE : keep in mind that the time limit given is of for the entire execution, meaning O(TN) for the O(N) solution, O(TN^2) for the O(N^2) solution and so on.
and 1s is aprox 10^8 operations.

Hope this helps,
Happy Coding :slight_smile:

1 Like

thank you