結果
| 問題 | 
                            No.1041 直線大学
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-05-01 21:35:04 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 1,552 bytes | 
| コンパイル時間 | 1,863 ms | 
| コンパイル使用メモリ | 172,156 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-16 07:48:36 | 
| 合計ジャッジ時間 | 3,012 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
#include <functional>  
#include <algorithm>  
#include <iostream>  
#include <fstream>  
#include <sstream>  
#include <iomanip>  
#include <numeric>  
#include <cstring>  
#include <cassert>  
#include <cstdio>  
#include <string>  
#include <vector>  
#include <bitset>  
#include <queue>  
#include <stack>  
#include <cmath>  
#include <ctime>  
#include <list>  
#include <set>  
#include <map>  
#include <bits/stdc++.h>
using namespace std;
#define PB push_back  
#define MP(A, B) make_pair(A, B)  
#define fi first  
#define se second  
#define gcd(a,b) __gcd(a,b)
#define pi acos(-1.0)
#define pii pair<int,int>
#define ll long long  
#define MAX 1000005  
#define MOD 1000000007  
#define INF 0x3f3f3f3f  
#define EXP 1e-8  
#define lowbit(x) (x&-x)  
ll qpow(ll p,ll q){ll f=1;while(q){if(q&1)f=f*p;p=p*p;q>>=1;}return f;}
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 
int x[105] = {0}, y[105] = {0};
int main() {
    int n, _max = INT_MIN;
    cin >> n;
    for (int i = 0; i < n; ++i) 
        cin >> x[i] >> y[i];
    for (int i = 0; i < n; ++i) {
        map<double, int> m;
        for (int j = 0; j < n; ++j) {
            if (i == j) continue;
            double k = ((double)y[i] - y[j]) / ((double)x[i] - x[j]);
            m[k]++;
            _max = max(_max, m[k]);
        }
    }
    cout << _max + 1 << endl;
    return 0;
}