- #include
-
- #define fst first
- #define scd second
- #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
- #define endl '\n'
- #define mems(a,x) memset(a,x,sizeof(a))
- #define pii pair
-
- using namespace std;
- using ll = long long;
- using ull = unsigned long long;
- using ldb = long double;
- using db = double;
-
- void solve();
-
- int main(){
- //IOS;
- solve();
- }
-
- void solve(){
- int n;
- cin >> n;
- vector
> a(n); - map<double,int> mp;
- for( int i = 0; i < n; ++i){
- cin >> a[i][0] >> a[i][1];
- a[i][2] = i;
- }
- ldb maxx = -1, maxi = -1;
- ldb maxi1 = -1;
- vector<bool> f(n,false);
- for( int i = 0; i < n; ++i){
- for(int j = i + 1; j < n; ++j){
- ldb k = (a[j][1] - a[i][1])*1.0 / (a[j][0] - a[i][0]);
- mp[k] ++;
- if(maxx < mp[k]){
- maxi1 = maxi;
- maxx = mp[k];
- maxi = k;
- }
- }
- }
- // maxx = n * n - 1 / 2
- ll ans = 0,ans1 = 0;
- ldb k;
- //这里犯了一个大错误,只考虑到斜率相等,就认为他们在一条直线上面了。
- for ( int i = 0; i < n; ++i){
- for( int j = i + 1; j < n; ++j){
- k = (a[j][1] - a[i][1])*1.0 / (a[j][0] - a[i][0]);
- if(k == maxi){
- if(f[i] == 0 && f[j] == 0){
- ans += 2;
- f[i] = f[j] = true;
- }
- else if ( a[i][2] == 0){
- f[i] = true;
- ++ans;
- }
- else if( a[j][2] == 0){
- f[j] = true;
- ++ ans;
- }
- else
- continue;
- }
- if(k == maxi1){
- if(f[i] == 0 && f[j] == 0){
- ans1 += 2;
- f[i] = f[j] = true;
- }
- else if ( a[i][2] == 0){
- f[i] = true;
- ++ans1;
- }
- else if( a[j][2] == 0){
- f[j] = true;
- ++ ans1;
- }
- else
- continue;
- }
- }
- }
- cout << max(ans,ans1) << endl;
- }