結果
| 問題 | 
                            No.1041 直線大学
                             | 
                    
| コンテスト | |
| ユーザー | 
                             saxofone111
                         | 
                    
| 提出日時 | 2020-05-04 10:36:00 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 1,718 bytes | 
| コンパイル時間 | 1,630 ms | 
| コンパイル使用メモリ | 175,496 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 08:00:39 | 
| 合計ジャッジ時間 | 2,705 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
#include "bits/stdc++.h"
#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};
ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}
ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}
ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}
ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}
bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }
  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
ll c(ll a){
  ll i=1;
  while(i*(i-1)<=2*a){
    if(i*(i-1)==2*a)return i;
    i++;
  }
  return i;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  llvec x(N), y(N);
  rep(i, N)cin >> x[i] >> y[i];
  ll ans = 0;
  rep(i, N){
    map<double, ll> cnt;
    FOR(j, i+1, N){
      if(i==j)continue;
      ll a=x[j]-x[i];
      ll b=y[j]-y[i];
      if(a==0)cnt[2000]++;
      else cnt[(double)(b)/a]++;
    }
    for(auto i:cnt){
      ans = max(ans, i.second+1);
    }
  }
  cout << ans;
  return 0;
}
            
            
            
        
            
saxofone111