Minimal Area - Gym 101755B - Virtual Judge (vjudge.net)
#include <bits/stdc++.h>
#define endl '\n'
#define INF 0x3f3f3f3f
#define ll long long
#define Mirai ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define pb push_back
using namespace std;
typedef pair<int, int> PII;
const int N = 2e5 + 10;
string s, t;
ll x[N],y[N];//分别存储每个点的x坐标和y坐标
int n;
ll res=5e18+1;
ll S(ll a,ll b,ll c,ll d)
{
return abs((ll)a*b-(ll)c*d);
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x[i]>>y[i];
}
x[n]=x[0];
y[n]=y[0];
x[n+1]=x[1];
y[n+1]=y[1];
for(int i=0;i<n;i++)
{
ll a=x[i+1]-x[i];
ll b=y[i+2]-y[i];
ll c=y[i+1]-y[i];
ll d=x[i+2]-x[i];
ll s=S(a,b,c,d);
res=min(res,s);
}
cout<<res;
return 0;
}