Submission #1192631

#TimeUsernameProblemLanguageResultExecution timeMemory
1192631boclobanchatPortal (BOI24_portal)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5;
pair<long long,long long> P[MAXN];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n,ans=0;
    cin>>n;
    if(n<=2) return cout<<-1,0;
    for(int i=1;i<=n;i++) cin>>P[i].first>>P[i].second;
    for(int i=1;i<n;i++) P[i].first-=P[i+1].first,P[i].second-=P[i+1].second,g=__gcd(g,P[i].second);
    for(int i=1;i<n;i++) for(int j=i+1;j<n;j++) ans=__gcd(ans,P[i].first*P[j].second-P[j].first*P[i].second);
    cout<<abs(ans);
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:14:78: error: 'g' was not declared in this scope
   14 |     for(int i=1;i<n;i++) P[i].first-=P[i+1].first,P[i].second-=P[i+1].second,g=__gcd(g,P[i].second);
      |                                                                              ^