#include #include #include #include using namespace std; const long long inf=(1LL)<<60; short path[4010][4010]; long long f[4010]; struct node { long long d; int num; int sh; }x[4010],y[4010]; int n,m; bool cmpd(node a,node b) { return a.d=1;j--) { if(f[j]