As you want an explanation about sub-tasks , I am not going into the logic or solution to the problem itself , and writing only about how the sub-tasks and points system works.
In general , sub-tasks are nothing but sets of constraints on the minimum/maximum values of the variables defined in the problem.
In simple language , for the given problem , you will get 20 points if your program can show correct answers within the time limit when the value of T is between 1 and 10^4 , and C and D are between 0 and 100 . You will get 20+30 points if your program can handle both this and larger values of T , C and D as mentioned in subtask 2, and will get 20+30+50=100 points if it can show correct results for all the three sets of constraints
How can a code pass one set of sub-tasks and fail others ?
As the constraints increase , your code might show wrong answer due to some faulty logic , or some variable overflow. The algorithm might not be optimized enough so it might exceed the time limit for larger constraints. Basically what it means is that only a correct answer to the problem is not enough for 100 points , your answer has to be scalable and optimized in order to get 100 points.
How to make your programs scalable and optimized ?
That is the whole point of competitive programming. You will have to read up extensively on data structures and algorithms , understand what sort of logic to use where , etc. All of this will come from practice and study.
I hope I was of help , if anything is unclear comment and I will try to help you out as good as I can