結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using ll = long long;

using namespace std;

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    scanf("%d", &n);

    vector<int> x(n), y(n);
    for (int i = 0; i < n; ++i)
        scanf("%d%d", &x[i], &y[i]);

    int res{ 0 };
    for (int i =0; i < n-1; ++i)
    {
        for (int j = i+1; j < n; ++j)
        {
            int dx{ x[j] - x[i] }, dy{ y[j] - y[i] }, resw{ 2 };
            for (int k = j + 1; k < n; ++k)
            {
                if ((x[k] - x[j]) * dy == (y[k] - y[j]) * dx)
                    ++resw;
            }
            res = max(res, resw);
        }
    }

    printf("%d\n", res);

    return 0;
}
0