結果

問題 No.1041 直線大学
ユーザー ui_mtcui_mtc
提出日時 2020-05-04 00:50:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 1,438 ms
コンパイル使用メモリ 168,464 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 08:00:42
合計ジャッジ時間 2,475 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

signed main() {
  int N;
  cin >> N;
  
  vector<int> X(N);
  vector<int> Y(N);
  for( int i = 0; i < N; i++ ) cin >> X[i] >> Y[i];
  
  int ans = 0;
  for( int i = 0; i < N; i++ ){
    for( int j = i+1; j < N; j++ ){
      int dx = X[i] - X[j];
      int dy = Y[i] - Y[j];
      int now = 0;
      for( int k = 0; k < N; k++ ){
        if( dx*(Y[i]-Y[k]) == (X[i]-X[k])*dy ) now++;
      }
      ans = max(ans, now);
    }
  }
  cout << ans << endl;
  
  
}
0