I solved a problem from august long challenge…my answer was partially accepted…it showed that subtask #2 have wrong answer…so i want to ask do i need to write different code for different subtasks…and what does subtask original constraints means??

Thank YOu

In the problem statements of long challenges, there is a **subtask** part which has **details of the constraints** for the particular subtask. The **initial subtasks** generally has **small constraints**, which typically means a **direct brute force approach will pass the subtask 1**. You need to **optimize the code further** to pass subtask 2. It is mentioned **“Original Constraints”** in the last subtask, which refers to **the constraints mentioned in the “Constraints” part** of the problem. The constraints of the subtask 1 and 2(or 1 in some cases) is less than the original constrains generally.

So, if your solution passes the subtask 1 or 2 and not the final subtask, it means that you need to optimize your code further or use different data types or try other approaches to solve the problem fully.

The code which passes the final subtask typically passes all the previous subtasks. So if you cant come up with an efficient approach to solve all the subtasks, you generally solve the first one/two subtasks with a brute force approach to gain a few points and move up the leaderboard(better than not solving any subtask at all). Hope your doubt is clear now. If you have any more doubt plz ask.

Hope this helps.