Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #define pb push_back
- #include <iostream>
- #include <climits>
- #include <algorithm>
- #include <iomanip>
- #include <cmath>
- #include <vector>
- #include <map>
- #include <string>
- #include <stack>
- #include <set>
- #include <cstdio>
- #include <cctype>
- #include <queue>
- #include <bitset>
- #include <functional>
- #include <cassert>
- #include <unordered_map>
- using namespace std;
- #define int long long
- typedef long long ll;
- typedef unsigned long long ull;
- typedef pair<ll, ll> pll;
- typedef pair<int, int> pii;
- typedef long double ld;
- typedef double db;
- const ll N = 5e5 + 20;
- const ll INF = LLONG_MAX;
- int gcd(int a, int b) {
- if (b == 0) return a;
- return gcd(b, a % b);
- }
- signed main() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- #else
- #endif
- ios_base::sync_with_stdio(0);
- cin.tie(0); cout.tie(0);
- int n;
- cin >> n;
- vector<pii> a(n);
- map<int, map<pii, int>> cnt;
- for (int i = 0; i < n; ++i) {
- cin >> a[i].first >> a[i].second;
- }
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- if (i == j) continue;
- int a1 = a[i].first - a[j].first;
- int b1 = a[i].second - a[j].second;
- int g = gcd(abs(a1),abs(b1));
- a1 /= g;
- b1 /= g;
- if (a1 < 0) {
- a1 *= -1;
- b1 *= -1;
- }
- cnt[i][{a1, b1}]++;
- //cnt[i][{-a1, -b1}]++;
- }
- }
- int ans = 0;
- for (int i = 0; i < n; ++i) {
- for (int j = 0; j < n; ++j) {
- if (i == j) continue;
- int a1 = a[i].first - a[j].first;
- int b1 = a[j].second - a[i].second;
- int g = gcd(abs(a1), abs(b1));
- a1 /= g;
- b1 /= g;
- if (a1 < 0) {
- a1 *= -1;
- b1 *= -1;
- }
- ans += cnt[j][{-b1, a1}];
- ans += cnt[j][{b1, -a1}];
- }
- }
- cout << ans << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement