Boundary

多校赛第二场B题

#include <bits/stdc++.h>
#define ll              long long
#define lll             unsigned long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e3 + 5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x % mod) + (y % mod)) % mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x % mod) * (y % mod)) % mod;
}
inline int inv(int x) {
    return qpow(x, mod - 2);
}
inline int divd(int x, int y) {
    return (1ll * (x % mod) * inv(y)) % mod;
}
int n, ans = 1, X[N], Y[N];

struct node
{
    double x,y;
    node(): node(0,0){}
    node(double x,double y):x(x),y(y){}
    bool operator < (const node& r)
    {
        return (double)x*r.y<(double)y*r.x;
    }
    bool operator == (const node& r)
    {
        return (double)x*r.y==(double)y*r.x;
    }
};

int Cross(int lhs, int rhs)
{
    return X[lhs] * Y[rhs] - X[rhs] * Y[lhs];
}

int Dot(int lhs, int rhs)
{
    return X[lhs] * X[rhs] + Y[lhs] * Y[rhs];
}

double Dis2(int lhs, int rhs)
{
    double dx = X[lhs] - X[rhs], dy = Y[lhs] - Y[rhs];
    return dx * dx + dy * dy;
}

int Sgn(int x)
{
    if (x > 0) return 1;
    if (x < 0) return -1;
    return 0;
}

node ar[N];

node cos2(ll x, ll y)
{
    ll a2=Dis2(0,x),b2=Dis2(x,y),c2=Dis2(0,y);
    int sgn=Sgn(b2+c2-a2);
    return node((double)1*sgn*(b2 + c2 - a2) * (b2 + c2 - a2), (double)4 * b2 * c2);
}

int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++)
        scanf("%d%d", X + i, Y + i);
    for (int i = 1; i <= n; i ++)
    {
        int cnt = 0;
        for (int j = 1; j <= n; j ++)
            if (Cross(i, j) > 0)
                ar[++cnt]=cos2(i,j);
        sort(ar+1,ar+cnt+1);
        for(int l=1,r;l<=cnt;l=r)
        {
            for(r=l;ar[l]==ar[r] && r<=cnt;r++);
            ans=max(ans,r-l+1);
        }
    }
    printf("%d\n", ans);
    return 0;
}

 

posted @ 2020-07-16 08:47  DeaL57  阅读(176)  评论(0编辑  收藏  举报