E. Summer Earnings

就是碰见三个圆或者四个圆的时候就想一下怎么用其他的东西等价一下啊。。。

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<bitset>
#include<math.h>
using namespace std;
struct node1
{
    int x,y,id;
}s[4000];
struct node
{
    int a,b,w;
}G[10000000];
bitset<4000>vis[4000];
int dis(int a,int b)
{
    int res=0;
    res+=(s[a].x-s[b].x)*(s[a].x-s[b].x);
    res+=(s[a].y-s[b].y)*(s[a].y-s[b].y);
    return res;
}
bool cmp(node x,node y)
{
    return x.w>y.w;
}
 
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&s[i].x,&s[i].y);
        s[i].id=i;
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            G[++cnt].w=dis(i,j);
            G[cnt].a=s[i].id;
            G[cnt].b=s[j].id;
        }
    }
    int ans=0;
    sort(G+1,G+1+cnt,cmp);
    for(int i=1;i<=cnt;i++)
    {
        int a=G[i].a,b=G[i].b;
        bitset<4000> temp;
        temp=vis[a]&vis[b];
        if(temp.any())
        {
            ans=G[i].w;
            break;
        }
        vis[a].set(b);
        vis[b].set(a);
    }
    printf("%lf\n",sqrt(ans)/2);
}

  

posted @   Heilce  阅读(217)  评论(0编辑  收藏  举报
编辑推荐:
· Brainfly: 用 C# 类型系统构建 Brainfuck 编译器
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
阅读排行:
· Tinyfox 发生重大改版
· DeepSeek 全面指南,95% 的人都不知道的9个技巧(建议收藏)
· 对比使用DeepSeek与文新一言,了解DeepSeek的关键技术论文
· Brainfly: 用 C# 类型系统构建 Brainfuck 编译器
· DeepSeekV3+Roo Code,智能编码好助手
点击右上角即可分享
微信分享提示