제출 #1339840

#제출 시각아이디문제언어결과실행 시간메모리
1339840ZicrusPortal (BOI24_portal)C++20
55 / 100
2094 ms1860 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
constexpr ll inf = 4e18;
mt19937 mt(time(0));

typedef complex<ll> point;
#define X real()
#define Y imag()

ll cross(point a, point b) {
    return a.X * b.Y - a.Y * b.X;
}

void solve() {
    ll n; cin >> n;
    vector<point> pts(n - 1);
    ll ox, oy; cin >> ox >> oy;
    for (auto &p : pts) {
        ll x, y; cin >> x >> y;
        p = point(x - ox, y - oy);
    }
    ll res = 0;
    for (ll i = 0; i < sz(pts); i++) {
        for (ll j = i+1; j < sz(pts); j++) {
            res = gcd(res, cross(pts[i], pts[j]));
        }
    }
    cout << res - !res << '\n';
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    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...