Submission #1219471

#TimeUsernameProblemLanguageResultExecution timeMemory
1219471omsincoconutPortal (BOI24_portal)C++17
1 / 100
12 ms1092 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; if (N <= 2) { cout << -1; return 0; } int x[N+1], y[N+1]; for (int i = 1; i <= N; i++) cin >> x[i] >> y[i]; ll dx1 = x[2] - x[1], dy1 = y[2] - y[1]; ll dx2 = x[3] - x[1], dy2 = y[3] - y[1]; ll sx, sy; if (dy1 == 0) { sx = dx1; } else if (dy2 == 0) { sx = dx2; } else { ll GCD = gcd(dy1,dy2); sx = dy1/GCD*dx1 - dy2/GCD*dx2; } if (dx1 == 0) { sy = dy1; } else if (dx2 == 0) { sy = dy2; } else { ll GCD = gcd(dx1,dx2); sy = dx1/GCD*dy1 - dx2/GCD*dy2; } if (sx == 0 || sy == 0) cout << -1; else cout << abs(sx*sy); return 0; } /* 3 1 1 1 3 3 2 5 0 0 1 0 -1 0 0 1 0 -1 1 1 -1 */
#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...