제출 #1051603

#제출 시각아이디문제언어결과실행 시간메모리
1051603deeraPortal (BOI24_portal)C++14
11 / 100
38 ms3000 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; struct Portal { public: ll x; ll y; }; void print(Portal p) { cout << p.x << " " << p.y << endl; } ll gcd(ll x, ll y) { return (ll)__gcd((int)x, (int)y); } void solve() { ll n; cin >> n; vector<Portal> portals(n); for (ll i = 0; i < n; i++) cin >> portals[i].x >> portals[i].y; if (n <= 2) return (void)(cout << -1 << endl); ll box_x = 0; ll box_y = 0; Portal c = portals[0]; for(auto p: portals) { box_x = gcd(std::abs(p.x - c.x), box_x); box_y = gcd(std::abs(p.y - c.y), box_y); } ll a = box_x * box_y; if (n == 3) a = min(a, 4ll); // JUST TESTING 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...