#include #include #include #include #include using namespace std; int gcd(int a, int b){ while(a>0 && b>0){ if(a>b) a %= b; else b %= a; } return a+b; } int abss(int x){ return x<0 ? -x : x; } int sgn(int x){ return x<0 ? -1 : 1; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int w,h,sx,sy,ex,ey; cin >> w >> h >> sx >> sy >> ex >> ey; vector>H(w/2+1, vector(h/2+1)); for(int i=1;i<=h/2;i++) for(int j=1;j<=w/2;j++) cin >> H[j][i]; //process cross-points double result = 0.0; setUsedX, UsedY; int deltaX = ex-sx; int deltaY = ey-sy; int segs = gcd(abss(deltaX), abss(deltaY)); if(deltaX!=0 && deltaY!=0) for(int i=1;i