SRM 565 Div2 500 use DP to solve