#include int dp[3010][3010][2]; int N; int M; int Max(int x,int y){return x>y?x:y;} int Min(int x,int y){return x