Constraints and Subtasks are two totally different things!
Constraints
- It tells about range of inputs and testcases.
- Maximum size of the array you require to solve the problem.
- Maximum length of string etc.
Subtasks
- Subtasks are different set of testcases to check your code efficiency and Time constraints.
- Every problems has subtasks it really helps during Competition you can check for which range of inputs my solution is not working.
Consider this example
Problem : FEB15 Chef and Chain
constraints
- 1 ≤ T ≤ 7 // maximum number of testcases is 7
- 1 ≤ |S| ≤ 10^5 // maximum size of string you require for this problem is 10^5
Subtasks
- Subtask 1 ≤ |S| ≤ 10, 1 ≤ T ≤ 7 Points: 20 // if your code passes all the testcases where string has size not greater than 10 then you'll get 20 points
- Subtask 1 ≤ |S| ≤ 1000, 1 ≤ T ≤ 7 Points: 30 // same applies here
- Subtask 1 ≤ |S| ≤ 10^5, 1 ≤ T ≤ 7Points: 50
Hope it helps!
Thank you!!
AlgoWiki ~ All the links and resources on different topics of Computer Science at one place!
answered
19 Feb '15, 20:21
1★vicky002 ♦♦
256●1●3●14
accept rate:
27%