In the first test, he will complete the task with topic $1$ in $2$ minutes, and the task with topic $2$ in $2$ minutes, spending a total of $4$ minutes.

In the second test, when solving the task with topic $2$ for the first time, he will spend $4$ minutes, when solving it again, he will spend $\max(\lfloor \frac{4}{2} \rfloor,1)=2$ minutes, and when solving the task with topic $2$ for the third time, he will spend $\max(\lfloor \frac{2}{2} \rfloor,1)=1$ minute, so in total he will spend $4+2+1=7$ minutes.