Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.5 kB
1
Indexable
Never
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define EPS 1e-9
#define mod 1000000007
#define over 10000000000
#define sz(m) (ll)(m.size())
#define ceil(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
bool sortbysecdesc(pair<int, int> &a, pair<int, int> &b)
{
  if (a.first == b.first)
    return a.second > b.second;
  else
    return a.first < b.first;
}
#define fixed(n) fixed << setprecision(n)
const ll inf = 1e18 + 5;
//  priority_queue<int, vector<int>, greater<int> > pq ;
template <typename T = int>
istream &operator>>(istream &in, vector<T> &v)
{
  for (T &i : v)
    in >> i;
  return in;
}
template <typename T = int>
ostream &operator<<(ostream &out, const vector<T> &v)
{
  for (const T &x : v)
    out << x << ' ';
  return out;
}

void lol()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin), freopen("outputt.txt", "w", stdout), freopen("error.txt", "w", stderr);
#endif
}
double log(double base, double x)
{
  return (log(x) / log(base));
}

ll ncr(ll n, ll r)
{
  vector<ll> inv(r + 1);
  ll ans = 1;
  inv[0] = 1;
  if (r + 1 >= 2)
    inv[1] = 1;
  for (int i = 2; i <= r; i++)
    inv[i] = mod - (mod / i) * inv[mod % i] % mod;
  // to get 1 / (r!)
  for (int i = 2; i <= r; i++)
    ans = ((ans % mod) * (inv[i] % mod)) % mod;
  for (int i = n; i >= (n - r + 1); i--)
    ans = ((ans % mod) * (i % mod)) % mod;
  return ans;
}
int dx[4] = {1, 0, 0, -1};
int dy[4] = {0, 1, -1, 0};
ll fast_power(ll base, ll p)
{
  if (!p)
    return 1;
  unsigned ll ret = fast_power(base, p / 2);
  ret = (ret * ret);
  if (p % 2)
    ret = (ret * base);
  return ret;
}
int add(ll a, ll b)
{
  return (a + b) % mod;
}
///////////// beginning of the code //////////

int main()
{
  lol();
  int n;
  cin >> n;
  ll ans = 5e18 + 5;
  vector<pair<ll, ll>> in(n + 2);
  for (int i = 0; i < n; i++)
  {
    cin >> in[i].first >> in[i].second;
  }
  in[n].first = in[0].first, in[n].second = in[0].second;
  in[n + 1].first = in[1].first, in[n + 1].second = in[1].second;
  for (int i = 0; i < n; i++)
  {
    ll ax = in[i].first, ay = in[i].second;
    ll bx = in[i + 1].first, by = in[i + 1].second;
    ll cx = in[i + 2].first, cy = in[i + 2].second;
    ll a = (bx - ax);
    ll b = (cx - ax);
    ll c = (by - ay);
    ll d = (cy - ay);
    ll area = (a * d - b * c);
    ans = min(ans, area);
  }
  cout << ans << '\n';
}