Submission #1261264

#TimeUsernameProblemLanguageResultExecution timeMemory
1261264kikitop1ggPortal (BOI24_portal)C++17
55 / 100
2096 ms1860 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vector<ll>> #define vs vector<string> #define vc vector<char> #define vb vector<bool> #define vp vector<pair<ll, ll>> #define vpp vector<pair<ll, pair<ll, ll>>> #define pp pair<ll, ll> #define qi queue<ll> #define qp queue<pp> #define pqi priority_queue<ll> #define pqp priority_queue<pp> #define mi map<ll, ll> #define mpi map<pp, ll> #define mip map<ll, pp> #define mp map<pp, pp> #define mb map<ll, bool> #define si set<ll> #define sp set<pp> #define sc set<char> #define mod 1000000007 #define inf INT_MAX #define all(x) (x).begin(), (x).end() ll cross(pp start1, pp end1, pp start2, pp end2) { ll x1 = end1.first - start1.first; ll y1 = end1.second - start1.second; ll x2 = end2.first - start2.first; ll y2 = end2.second - start2.second; ll ans = abs(x1 * y2 - x2 * y1); return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n; cin >> n; vp a(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } if(n <= 2) { cout << "-1\n"; return 0; } ll ans = 0; for(int i = 1; i < n; i++) { for(int j = i + 1; j < n; j++) { ll cur = cross(a[0], a[i], a[0], a[j]); ans = gcd(ans, cur); } } if(ans == 0) ans = -1; cout << ans << '\n'; 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...