Files

59 lines
1.0 KiB
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
set<pair<ll, ll>> spells;
ll gcd(ll a, ll b){
if(b == 0){
return a;
}
return gcd(b, a % b);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<pair<ll, ll>> cities(n);
for(int i = 0; i < n; ++i){
ll x, y;
cin >> x >> y;
cities[i] = {x, y};
for(int j = 0; j < i; ++j){
ll dx = cities[j].first - cities[i].first;
ll dy = cities[j].second - cities[i].second;
if(dx == 0){
spells.insert({0, 1});
spells.insert({0,-1});
} else if(dy == 0){
spells.insert({1,0});
spells.insert({-1, 0});
} else{
ll g = gcd(dx, dy);
dx /= g;
dy /= g;
spells.insert({dx, dy});
spells.insert({-1*dx, -1*dy});
}
}
}
cout << spells.size();
cout << flush;
return 0;
}