Sir doubt in this questoin

sir in editorial why are we making dp[5000][5000]???
there may be posiblity both the players choses only first example n=10000 and i=0 and j=10000-1 and always both the players choses first element always so the i may become 9000 also then why are we chosing dp[5000][5000] as it may also be posiblity that i=6000 and j =9000 isnt it??

hello @tejasddongare
we cannot make 100000 x 100 000 size dp array because it will consume 2 much memory and probably give run error.
thats us why we are storing only upto-> i< 5000 && j <5000

for i and j bigger than 5000 we are never storing them ,we are always calling their subproblems and then sending the result