This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
typedef unsigned long long ull;
using namespace std;
const int N=1e5+5;
int x[N],y[N],n,dx[N],dy[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=n;i++) cin>>x[i]>>y[i],dx[i]=x[i],dy[i]=y[i];
if (n<=2){
cout<<-1<<endl;
return 0;
}
if (x[1]==x[2] && x[1]==x[3]){
cout<<-1<<endl;
return 0;
}
if (y[1]==y[2] && y[1]==y[3]){
cout<<-1<<endl;
return 0;
}
for (int i=1;i<=n;i++){
int z=min(abs(x[i]),abs(y[i]));
dx[i]=abs(x[i])-z;
dy[i]=abs(y[i])-z;
}
bool ok=true;
for (int i=1;i<=n;i++) ok&=(dx[i]==dx[1] && dy[i]==y[1]);
if (ok){
cout<<-1<<endl;
return 0;
}
if (x[1]!=x[2] && x[1]!=x[3] && x[2]!=x[3] && y[1]!=y[2] && y[1]!=y[3] && y[2]!=y[3]){
cout<<2<<endl;
return 0;
}
sort(x+1,x+1+n);
sort(y+1,y+1+n);
int X=x[3]-x[1]+1,Y=y[3]-y[1]+1;
cout<<X*Y-X-Y+1<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |