Variable visited is used to keep track of all the visited positions Variable dp is used to store maximum sum till current position
vector < vector < int > > dp ( N , vector < int > ( N ) ) , visited ( N , vector < int > ( N ) ) ;