結果

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

ソースコード

diff #

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

int main(){
    int n;
    cin >> n;
    vector<int> X(n), 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++){
            if (X[i] == X[j])
                continue;
            int dx = X[i] - X[j];
            int dy = Y[i] - Y[j];

            int res = 0;
            for (int k = 0; k < n; k++){
                if (dy * (X[k] - X[i]) % dx != 0)
                    continue;
                int y = dy * (X[k] - X[i]) / dx + Y[i];
                if (y == Y[k])
                    res++;
            }
            ans = max(ans, res);
        }
    }

    cout << ans << endl;
}
0