結果
| 問題 | No.1041 直線大学 | 
| コンテスト | |
| ユーザー |  shop_one | 
| 提出日時 | 2020-05-01 21:29:28 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 788 bytes | 
| コンパイル時間 | 1,123 ms | 
| コンパイル使用メモリ | 95,300 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 07:45:53 | 
| 合計ジャッジ時間 | 1,952 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll n,ans=0,dx,dy;
  cin >> n;
  vector<ll> x(n),y(n);
  for(int i=0;i<n;i++){
    cin >> x[i] >> y[i];
  }
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      dy = y[j]-y[i];
      dx = x[j]-x[i];
      ll tmp = 0;
      for(int k=0;k<n;k++){
        if(dx*(y[k]-y[i])==dy*(x[k]-x[i])){
          tmp++;
        }
      }
      ans = max(ans,tmp);
    }
  }
  cout << ans << endl;
}
            
            
            
        