how to satisfy a subtask in a problem?

I recently solved the problen Chef and notebooks (CNOTE) from the march challenge.
I used java language.
I scored only 40 points after submitting.
The rest 60 points were for satisfying the following subtask
“Sum of N over all test cases in one test file does not exceed 10^6.”
For which I wrote the code as follows-

if(sum>Math.pow(10, 6))
System.exit(0);

Sum is a variable in which all the values of N are added in each test case.
Still it doesn’t accept it

SOLUTION : You need more practice and need to get the algos required in the problem.

EXPLANATION :

  • You need to first find the problem specifications and the reason why your solution fails for some subtasks.
  • After the contest ends and the time when the editorial is published focus on the part you were lagging ....This will make you learn a lot of things
  • Learn some of the Algorithms you need mostly in the contest like Segment Tree,Dp and many more
  • The best way to learn coding is to code

HAPPY CODING