Author: Error_Yuan
Hint
Over all the triples, which is the most important one?
tutorial
Noticing that, after sorting, if the triple $$$(1,2,n)$$$ is valid (i.e. $$$a_1+a_2 \gt a_n$$$), then the whole array is valid. Thus, we are going to maximize the value of $$$a_1+a_2-a_n$$$ and check if it is greater than $$$0$$$. To do this, the optimal solution is to choose $$$a=[m-n+1,m-n+2,\ldots,m]$$$.



