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>
using namespace std;
void solve(){
int n;cin >> n;
if(n<=2) {
cout << "-1\n";
return;
}
int x[n],y[n];
for(int i = 0;i < n;i++) cin >> x[i] >> y[i];
int gx = 0, gy = 0;
for(int i = 1;i < n;i++){
x[i] -= x[0];
y[i] -= y[0];
if(x[i]) gx = __gcd(gx, abs(x[i]));
if(y[i]) gy = __gcd(gy, abs(y[i]));
}
if(gx && gy) cout << (long long)gy*gx << '\n';
else cout << "-1\n";
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
# | 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... |