Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define forn(i, n) for(int i = 0; i < (int)(n); ++i)
- using namespace std;
- struct pt
- {
- int x, y;
- };
- pt operator-(const pt &a, const pt &b)
- {
- pt res;
- res.x = b.x - a.x;
- res.y = b.y - a.y;
- return res;
- }
- int64_t vec_mult(const pt &a, const pt &b)
- {
- return (int64_t)(a.x) * b.y - (int64_t)(a.y) * b.x;
- }
- int64_t scal_mult(const pt &a, const pt &b)
- {
- return (int64_t)(a.x) * b.x + (int64_t)(a.y) * b.y;
- }
- int main()
- {
- int n;
- cin >> n;
- vector<pt> p(n);
- int ans = 0;
- forn (i, n) cin >> p[i].x >> p[i].y;
- sort(p.begin(), p.end());
- for (int i = 0; i < n - 2; ++i) // a
- {
- for (int j = i + 1; j < n - 1; ++j) // b
- {
- for (int m = j + 1; m < n; ++m) // c
- {
- if (scal_mult(p[m] - p[j], p[i] - p[m]) == 0) ++ans;
- }
- }
- }
- cout << ans << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement