Submission #1049432

#TimeUsernameProblemLanguageResultExecution timeMemory
1049432aymanrsPortal (BOI24_portal)C++17
11 / 100
13 ms2776 KiB
#include<bits/stdc++.h> using namespace std; void solve(){ int n;cin >> n; if(n<=2) { cout << "-1\n"; return; } int x[n],y[n]; for(int i = 0;i < n;i++) cin >> x[i] >> y[i]; int gx = 0, gy = 0; for(int i = 1;i < n;i++){ x[i] -= x[0]; y[i] -= y[0]; if(x[i]) gx = __gcd(gx, abs(x[i])); if(y[i]) gy = __gcd(gy, abs(y[i])); } if(gx && gy) cout << (long long)gy*gx << '\n'; else cout << "-1\n"; } int main(){ ios_base::sync_with_stdio(false); 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...