結果

問題 No.1041 直線大学
ユーザー RyumaRyama
提出日時 2020-06-27 19:33:50
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 870 bytes
コンパイル時間 1,688 ms
コンパイル使用メモリ 141,584 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 08:05:54
合計ジャッジ時間 2,833 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;
using P = pair<int, int>;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

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++) {
            int cnt = 2;
            for (int k=0; k<n; k++) {
                if (k==i || k==j) continue;
                if ((x[j]-x[i])*(y[k]-y[i]) == (y[j]-y[i])*(x[k]-x[i]))
                    cnt++;
            }
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
}
0