結果
| 問題 | No.1041 直線大学 | 
| コンテスト | |
| ユーザー |  merom686 | 
| 提出日時 | 2020-05-01 21:29:40 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 884 bytes | 
| コンパイル時間 | 1,064 ms | 
| コンパイル使用メモリ | 91,396 KB | 
| 最終ジャッジ日時 | 2025-01-10 04:13:04 | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
struct P {
    int x, y;
};
int main() {
    int n;
    cin >> n;
    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        p[i] = { x, y };
    }
    int r = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < i; j++) {
            int t = 2;
            for (int k = 0; k < n; k++) {
                if (k == i || k == j) continue;
                int x0 = p[i].x - p[j].x;
                int x1 = p[i].x - p[k].x;
                int y0 = p[i].y - p[j].y;
                int y1 = p[i].y - p[k].y;
                if (x0 * y1 - x1 * y0 == 0) t++;
            }
            r = max(r, t);
        }
    }
    cout << r << endl;
    return 0;
}
            
            
            
        