제출 #1192631

#제출 시각아이디문제언어결과실행 시간메모리
1192631boclobanchatPortal (BOI24_portal)C++20
컴파일 에러
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); }

컴파일 시 표준 에러 (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);
      |                                                                              ^