Submission #994639

#TimeUsernameProblemLanguageResultExecution timeMemory
994639PenguinsAreCutePortal (BOI24_portal)C++17
11 / 100
2076 ms1116 KiB
// yay linear algebra! #include <bits/stdc++.h> using namespace std; using ll = long long; main() { int n; cin >> n; int x[n], y[n]; for(int i=0;i<n;i++) cin>>x[i]>>y[i]; for(int i=1;i<n;i++) x[i]-=x[0],y[i]-=y[0]; int g = 0; for(int i=1;i<n;i++) g=__gcd(g,x[i]); g=abs(g); for(int i=1;i<n;i++) x[i]/=g; ll g2 = 0; for(int i=1;i<n;i++) for(int j=i+1;j<n;j++) g2=__gcd(g2,1LL*x[i]*y[j]-1LL*x[j]*y[i]); if(!g2) {cout<<"-1"; return 0;} cout << abs(g * g2) << "\n"; }

Compilation message (stderr)

Main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main() {
      | ^~~~
#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...