Submission #1095105

#TimeUsernameProblemLanguageResultExecution timeMemory
1095105SalihSahinPortal (BOI24_portal)C++14
Compilation error
0 ms0 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]; } if(n <= 2){ cout<<-1<<endl; return 0; } sort(x.begin(), x.end()); sort(y.begin(), y.end()); int df1 = mod, df2 = mod; for(int i = 0; i < n-1; i++){ df1 = gcd(df1, x[i+1] - x[i]); df2 = gcd(df2, y[i+1] - y[i]); } cout<<df1 * df2<<endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:31:15: error: 'gcd' was not declared in this scope
   31 |         df1 = gcd(df1, x[i+1] - x[i]);
      |               ^~~