| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1361494 | Newtonabc | Portal (BOI24_portal) | C++20 | 33 ms | 3540 KiB |
#include<bits/stdc++.h>
#define ll __int128
using namespace std;
const int N=1e5+10;
ll tx,ty,rx;
ll x[N],y[N];
ll uwu(ll x){
if(x<0) return -x;
return x;
}
void f(ll ux,ll uy){
//finding new bound tx, ty using euclid's like algo.
if(uy<0) ux=-ux,uy=-uy;
if(ty<uy) swap(tx,ux),swap(ty,uy);
while(uy){
ll dv=ty/uy;
ty-=uy*dv;
tx-=ux*dv;
swap(ty,uy);
swap(tx,ux);
}
rx=__gcd(rx,uwu(ux));
}
int main(){
int n; cin>>n;
vector<pair<ll,ll>> red;
for(int i=1;i<=n;i++){
long long tmpx,tmpy; cin>>tmpx >>tmpy;
x[i]=tmpx,y[i]=tmpy;
}
if(n==1){
cout<<-1;
return 0;
}
for(int i=2;i<=n;i++){
f(x[i]-x[1],y[i]-y[1]);
}
if(rx==0 || ty==0) cout<<-1;
else cout<<(long long)abs((long long)rx*(long long)ty);
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
