結果

問題 No.1041 直線大学
ユーザー woyuki_woyuki_
提出日時 2020-05-01 22:06:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,722 bytes
コンパイル時間 1,348 ms
コンパイル使用メモリ 166,980 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 13:50:20
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define repb(i, n) for (int i = (int) n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int) m; i < (int) n; i++)
#define repsb(i, m, n) for (int i = (int) m; i >= (int) n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
# define pb(a) push_back(a)
#define ll long long int
int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return 1; } return 0; }
template < class T > bool chmin(T & a,const T & b) { if (b < a) { a = b; return 1; } return 0; }
//vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));
using namespace std;
int main(int argc, char const * argv[]){
    int n;
    cin >> n;
    typedef pair<int, int> pair;
    vector<pair> xy(n);
    vector<pair> d(n); //a,b
    rep(i, n)
    {
        cin >> xy[i].first >> xy[i].second;
    }
    int cnt = 2;
    rep(i, n)
    {
        rep(j,n){
            int tmp = 0;
            if (i == j ||xy[i].first-xy[j].first==0)
                continue;

            double t = (xy[i].second - xy[j].second) / (xy[i].first - xy[j].first);
            //cout << t << endl;
            double b = xy[j].second - t * xy[j].first;
            //cout << b << endl;

            rep(p,n){
//                cout << "ans" << (int)(xy[p].second + 0.5) <<"\tans2 "<<(int)(t + 0.5) * xy[p].first + (int)(b + 0.5)<<endl;
                if ((int)(xy[p].second + 0.5) == (int)(t + 0.5) * xy[p].first + (int)(b + 0.5))
                {
                    tmp++;
                }
            }
            cnt = max(cnt, tmp);
        }
    }
    cout<<cnt<<endl;
    return 0;
}
0