제출 #1219476

#제출 시각아이디문제언어결과실행 시간메모리
1219476omsincoconutPortal (BOI24_portal)C++17
11 / 100
13 ms1216 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]; pair<int, int> minpos = {x[1], y[1]}; for (int i = 2; i <= N; i++) minpos = min(minpos, make_pair(x[i], y[i])); ll sx = 0, sy = 0; for (int i = 1; i <= N; i++) { ll dx = abs(minpos.first - x[i]); ll dy = abs(minpos.second - y[i]); if (dx != 0 && dy == 0) sx = gcd(sx, dx); if (dy != 0 && dx == 0) sy = gcd(sy, dy); } cout << (sx*sy == 0 ? -1 : 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...