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;
struct Portal {
public:
int x;
int y;
};
void print(Portal p) {
cout << p.x << " " << p.y << endl;
}
void solve() {
int n;
cin >> n;
vector<Portal> portals(n);
for (int i = 0; i < n; i++)
cin >> portals[i].x >> portals[i].y;
if (n <= 2) return (void)(cout << -1 << endl);
int box_x = 0;
int box_y = 0;
Portal c = portals[0];
for(auto p: portals) {
box_x = __gcd(abs(p.x - c.x), box_x);
box_y = __gcd(abs(p.y - c.x), box_y);
}
int a = box_x * box_y;
if (a == 0) cout << -1 << endl;
else cout << a << endl;
}
int main() {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... |