1 solutions

  • 0
    @ 2025-12-3 16:23:58

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int p,a,b,c,d;
    int main()
    {
    //	freopen("750.in","r",stdin);	
    //	freopen("750.out","w",stdout);
    	cin>>p>>a>>b>>c>>d;
    	if(a==c && b==d) {cout<<0;return 0;}
    	int he1=a+b,cha1=a-b;
    	int he2=c+d,cha2=c-d;
    	if(he1==he2 || cha1==cha2) cout<<1;
    	else if(he1%2==he2%2) cout<<2;
    		else cout<<-1;
    	return 0;	 
    }
    
    
    
    • 1

    Information

    ID
    870
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By