제출 #1076537

#제출 시각아이디문제언어결과실행 시간메모리
1076537ArturgoPortal (BOI24_portal)C++14
1 / 100
41 ms1796 KiB
#include <bits/stdc++.h> using namespace std; long long N, A, B, C, X, Y, OX, OY; int main() { cin >> N >> OX >> OY; N--; while(N--) { cin >> X >> Y; X -= OX; Y -= OX; while(X != 0) { if(X < 0) { X = -X; Y = -Y; } int R = A / X; A -= R * X; B -= R * Y; swap(A, X); swap(B, Y); } while(Y != 0) { if(Y < 0) { Y = -Y; } int R = C / Y; C -= R * Y; swap(C, Y); } if(C != 0) { B %= C; } } if(A == 0 || C == 0) cout << -1 << endl; else cout << (long long)abs(A * C) << endl; 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...