记录编号 204481 评测结果 AAAAAAAAAA
题目名称 [SYOI 2015] Asm.Def找燃料 最终得分 100
用户昵称 Gravatar---- 是否通过 通过
代码语言 C++ 运行时间 0.185 s
提交时间 2015-11-04 12:56:32 内存使用 0.32 MiB
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
template<class T> inline void mint(T& a, T b) { if (a > b) a = b; }
template<class T> inline void maxt(T& a, T b) { if (a < b) a = b; }
const int maxn = 233;
int X[maxn], Y[maxn], ord[maxn], hhx, hhy;
inline int GET(int i) { return hhx * Y[i] - hhy * X[i]; }
inline pair<int, int> get(int i) { return make_pair(X[i], Y[i]); }
inline bool cmp(int a, int b) { return GET(a) < GET(b); }
inline bool cmp2(int a, int b) { return get(a) < get(b); }

int main()
{
    freopen("asm_fuel.in", "r", stdin);
#ifndef debug
    freopen("asm_fuel.out", "w", stdout);
#endif
    int n, ans = 0; scanf("%d", &n);
    for (int i = 0; i < n; ++i) scanf("%d%d", X + i, Y + i);
    for (int i = 0; i < n; ++i) ord[i] = i;
    sort(ord, ord + n, cmp2);
    for (int i = 0, j = 0; i < n; i = j)
    {
        while (j < n && get(ord[i]) == get(ord[j])) ++j;
        maxt(ans, j - i);
    }
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
        {
            hhx = X[i] - X[j]; hhy = Y[i] - Y[j];
            if (!hhx && !hhy) continue;
            sort(ord, ord + n, cmp);
            for (int k = 0, kk = 0; k < n; k = kk)
            {
                while (kk < n && GET(ord[kk]) == GET(ord[k])) ++kk;
                maxt(ans, kk - k);
            }
        }
    printf("%d\n", ans);
    
}