Submission #1082470

#TimeUsernameProblemLanguageResultExecution timeMemory
1082470EntityPlanttPortal (BOI24_portal)C++17
21 / 100
16 ms604 KiB
#include <iostream> #include <algorithm> using namespace std; #define int long long inline int area(int x1, int y1, int x2, int y2, int x3, int y3){ x2 -= x1, x3 -= x1; y2 -= y1, y3 -= y1; return abs(x2 * y3 - x3 * y2); } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, x0, y0, xl, yl, g = 0; cin >> n; if (n <= 2) { cout << -1; return 0; } cin >> x0 >> y0 >> xl >> yl; for (int i = 2; i < n; i++) { int x, y; cin >> x >> y; g = __gcd(g, area(x0, y0, xl, yl, x, y)); xl = x; yl = y; } cout << (g ? g : -1); return 0; }
#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...