Submission #1095108

#TimeUsernameProblemLanguageResultExecution timeMemory
1095108SalihSahinPortal (BOI24_portal)C++14
10 / 100
17 ms5116 KiB
#include <bits/stdc++.h> #define pb push_back #define int long long using namespace std; const int N = 3e5 + 5; const int K = 20; const int mod = 1e9 + 7; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; vector<array<int, 2> > p(n); vector<int> x(n), y(n); for(int i = 0; i < n; i++){ cin>>p[i][0]>>p[i][1]; x[i] = p[i][0]; y[i] = p[i][1]; } int df1 = 0, df2 = 0; for(int i = 0; i < n-1; i++){ df1 = __gcd(df1, abs(x[i+1] - x[i])); df2 = __gcd(df2, abs(y[i+1] - y[i])); } int ans = df1 * df2; if(!ans) cout<<-1<<endl; else cout<<ans<<endl; 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...