제출 #1051445

#제출 시각아이디문제언어결과실행 시간메모리
1051445deeraPortal (BOI24_portal)C++14
1 / 100
50 ms1116 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); } cout << (box_x - box_y) - 1 << 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...