#include #include int a[501],d[501]; int f[501][501]; int k,m; int max(int a,int b) { return a>b?a:b; } int min(int a,int b) { return a