結果

問題 No.1041 直線大学
ユーザー risujiroh
提出日時 2020-05-01 21:24:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 2,445 ms
コンパイル使用メモリ 194,012 KB
最終ジャッジ日時 2025-01-10 04:07:39
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define DEBUG(...)
#endif

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
  }
  int res = 0;
  for (int t = 0; t < n; ++t) {
    for (int s = 0; s < t; ++s) {
      int cur = 0;
      for (int i = 0; i < n; ++i) {
        cur += (x[i] - x[s]) * (y[t] - y[s]) - (x[t] - x[s]) * (y[i] - y[s]) == 0;
      }
      res = max(res, cur);
    }
  }
  cout << res << '\n';
}
0