結果

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

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long int;
using lc = complex<double>;

double dot(lc a, lc b) {
    return (a * conj(b)).real();
}
double cross(lc a, lc b) {
    return (a * conj(b)).imag();
}

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(32);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n;
    cin >> n;
    vector<lc> pt(n);
    for(auto &e: pt) {
        double x, y;
        cin >> x >> y;
        e = lc(x, y);
    }

    ll r = 0;
    for(ll i=0; i<n; i++)
    for(ll j=i+1; j<n; j++) {
        ll t = 2;
        for(ll k=j+1; k<n; k++)
            t += (abs(cross(pt[i]-pt[j], pt[k]-pt[j])) < 1e-6);
        r = max(r, t);
    }
    cout << r << endl;
}
0