Here is the solution link.
https://codeforces.me/contest/1625/submission/229144224
But suddenly Codeforces was giving "wrong output format Unexpected end of file — int32 expected (test case 4481)". I'm not familiar with this. Can anyone plz explain it ?I'm so sad about it.








it means that the checker was expecting an integer but your code did not output it. In other words, ur code outputted less integers than expected. In this case, the checker was expecting 293992 integers, so it means ur code outputted less than 293992 integers. So u should check why this is happening.
thanks for your hlep,I find it's true that my codeing can not print out 293992 intergers,and it's wrong about the transfer of DP.