結果

問題 No.1041 直線大学
ユーザー queee
提出日時 2020-05-01 21:33:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 923 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 76,044 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 22:24:51
合計ジャッジ時間 2,040 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std; using ll=long long; const int INF=1e9;
typedef pair<int,int> P;

int main() {
  int n; cin>>n;
  int x[n],y[n];
  for(int i=0;i<n;i++) cin>>x[i]>>y[i];
  int an=0;
  for(int i=0;i<n;i++) {
    for(int j=0;j<n;j++) {
      if (i == j) continue;
      int s = x[i] - x[j];
      int t = y[i] - y[j];

      bool os=s<0, ot=t<0;
      if (os) s*=-1;
      if (ot) t*=-1;

      int sm = 0;
      for(int k=0;k<n;k++) {
        int dx = x[k] - x[i], dy = y[k] - y[i];
        if (os) dx*=-1; if (ot) dy*=-1;
        if (s == 0) {
          if (x[i] == x[k] && dy % t == 0) sm++;
        } else if (t == 0) {
          if (y[i] == y[k] && dx % s == 0) sm++;
        } else {
          if (dy / t == dx / s && dy % t == 0 && dx % s == 0) sm++;
        }
      }
      an = max(an, sm);
    }
  }
  cout<<an<<endl;
}
0