#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector <pair <int, int>> v;
for(int i = 0;i < n;i++){
int a, b;
cin >> a >> b;
v.push_back({a, b});
}
if(n <= 2){
cout << -1 << '\n';
return;
}
int difx = 1e9;
sort(v.begin(), v.end());
for(int i = 1;i < n;i++){
if(v[i].first == v[i-1].first) continue;
difx = min(difx, v[i].first-v[i-1].first);
}
for(int i = 0;i < n;i++){
swap(v[i].first, v[i].second);
}
sort(v.begin(), v.end());
int dify = 1e9;
for(int i = 0;i < n;i++){
if(v[i].first == v[i-1].first) continue;
dify = min(dify, v[i].first-v[i-1].first);
}
cout << (difx == (int) 1e9 or dify == (int) 1e9 ? -1 : (difx-1)*(dify-1)) << '\n';
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:16:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
16 | return;
| ^~~~~~