Submission #1051447

#TimeUsernameProblemLanguageResultExecution timeMemory
1051447deeraPortal (BOI24_portal)C++14
1 / 100
30 ms1224 KiB
#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 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...