Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define ll long long
- #define f first
- #define s second
- using namespace std;
- const int N = 2506;
- ll n, tx, ans, k, k1, k2, st;
- map < pair <int, int>, int > sto;
- map < pair <int, int>, int > :: iterator it;
- pair <int, int> t, t1, t2, a[N];
- int main()
- {
- ios_base::sync_with_stdio(); cin.tie(); cout.tie();
- cin >> n;
- for (int i = 1; i <= n; i++)
- cin >> a[i].f >> a[i].s;
- for (int i = 1; i <= n; i++)
- {
- sto.clear();
- for (int j = 1; j <= n ;j++)
- {
- if (i == j)
- continue;
- t = {a[j].f - a[i].f, a[j].s - a[i].s};
- st = __gcd(t.f, t.s);
- t.f /= st;
- t.s /= st;
- sto[t]++;
- }
- for (it = sto.begin(); it != sto.end(); it++)
- {
- t = (*it).f;
- k = (*it).s;
- if (k == 0)
- continue;
- k1 = 0;
- k2 = 0;
- t1 = {t.f, -t.s};
- if (t1 != t)
- k1 = sto[t1];
- t2 = {-t.s, t.f};
- if (t2 != t)
- k2 = sto[t2];
- ans += k * k1 + k * k2;
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement