Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int gcd (int a, int b) {
- while (b) {
- a %= b;
- swap (a, b);
- }
- return a;
- }
- signed main() {
- #ifdef DEBUG
- fr("input.txt");
- // fw("output.txt");
- #else
- fr("input.txt");
- fw("output.txt");
- #endif
- int n;
- cin >> n;
- vector<pair<int, int> > pt(n);
- int ans = 0;
- for(int i = 0; i < n; i++) cin >> pt[i].f >> pt[i].s;
- for(int i = 0; i < n; i++){
- int d = 0;
- map<pair<int, int>, int> kek;
- for(int j = 0; j < n; j++){
- if(i == j) continue;
- int dx = pt[i].f - pt[j].f;
- int dy = pt[i].s - pt[j].s;
- int g = gcd(dx, dy);
- if(g != 0){
- dx /= g;
- dy /= g;
- }
- kek[{dx, dy}]++;
- }
- for(auto &a: kek){
- // cout << a.first.first << ' ' << a.first.second << ':' << a.second << endl;
- d += a.second * kek[{a.first.second, -a.first.first}];
- d += a.second * kek[{-a.first.second, a.first.first}];
- }
- ans += d / 2;
- // cout << d << endl;
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement