subtask problem

hi, I am new to competitive programming. i have solved some of basic questions but i face problems in each and every question where there are subtasks. like in this problem,
Constraints
1≤T≤1,000
1≤N≤1018
N does not contain the digit 0
1≤d≤9
Subtask #1 (40 points):
1≤T≤100
1≤N≤109
Subtask #2 (60 points): original constraints

i found difficulty when there are 2 different ranges for a single variable i.e subtask.
can you please help me out to understand how to score in these questions and submit successfully.

The ranges for a variable are its upper and lower limits in the input. For example, if there is an array which has N elements, and 1$\leq$N$\leq10^5$, it means that in the input, the array will have atleast 1 and atmost 10^5 elements. This helps us in estimating the Time Complexity that our program, to solve the problem, must have. You can learn more about this here. For other general queries, you can refer to this.

The purpose of subtasks is to let algorithms of certain Time Complexity pass, and others, not.
For example, consider a problem in which you have to deal with N numbers, and there are two subtasks -

  1. 1 \leq N \leq 10^3
  2. 1 \leq N \leq10^5

For the first subtask, our program will successfully run even if it has a Time Complexity of O(N^2), while for the second one it won’t. For the second subtask, we’ll need to use a faster algorithm. Thus, if you are able to pass a certain subtask, you’ll get the points for that subtask.

Problems which have a number of test cases T in the input, for them, the final complexity is O(T*worst case complexity of individual test case).

Feel free to ask if you have any doubts :slight_smile: