結果

問題 No.1041 直線大学
ユーザー bond_cmprogbond_cmprog
提出日時 2020-05-01 21:43:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,706 bytes
コンパイル時間 2,051 ms
コンパイル使用メモリ 202,492 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 08:41:40
合計ジャッジ時間 3,836 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 5 ms
4,384 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    int ma = 0;
    REP(i,N) cin >> x[i] >> y[i];
    REP(i,N) for(int j=i+1;j<N;j++){
        int dx = abs(x[j] - x[i]), dy = abs(y[j] - y[i]);
        // if(dx < 0) dx *= -1, dy *= -1;
        int g = gcd(dx, dy);
        if(dx == 0) dy = 1;
        else if(dy == 0) dx = 1;
        else dx /= g, dy /= g;
        int tmp = 2;
        REP(k,N) if(k != i && j != k){
            int ddx = abs(x[k] - x[i]), ddy = abs(y[k] - y[i]);
            // if(ddx < 0) ddx *= -1, ddy *= -1;
            int gg = gcd(ddx, ddy);
            if(ddx == 0) ddy = 1;
            else if(ddy == 0) ddx = 1;
            else ddx /= gg, ddy /= gg;
            if(ddx == dx && ddy == dy) tmp++;
        }
        chmax(ma, tmp);
    }
    cout << ma << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}
0