Submission #994748

#TimeUsernameProblemLanguageResultExecution timeMemory
994748LCJLYPortal (BOI24_portal)C++14
1 / 100
14 ms1884 KiB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef pair<int,pii>pi2;

void solve(){	
	int n;
	cin >> n;
	pii arr[n];
	for(int x=0;x<n;x++){
		cin >> arr[x].first >> arr[x].second;
	}
	
	if(n==1){
		cout << -1 << "\n";
	}
	else if(n==2){
		if(arr[0].first==arr[1].first){
			cout << abs(arr[0].second-arr[1].second);
		}
		else if(arr[0].second==arr[1].second){
			cout << abs(arr[0].second-arr[1].second);
		}
		else cout << -1;
	}
}
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	//freopen("in.txt","r",stdin);
	while(t--){
		solve();
	}
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...