結果

問題 No.1041 直線大学
ユーザー RyumaRyamaRyumaRyama
提出日時 2020-05-01 22:44:41
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 524 bytes
コンパイル時間 3,096 ms
コンパイル使用メモリ 93,612 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-20 15:02:39
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<double> 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-1; i++) {
        int cnt = 2;
        double a, b;
        a = (y[i]-y[i+1])/(x[i]-x[i+1]);
        b = y[i] - a*x[i];
        for (int j=i+2; j<n; j++)
            if (a*x[j]+b-0.1 < y[j] && y[j] < a*x[j]+b+0.1) cnt++;
        ans = max(ans, cnt);
    }

    cout << ans << endl;
}
0