【题目分析】

找一个边长最大的三元环。

把边排序,然后依次加入。加入(i,j)时,把i和j取一个交集,看看是否存在,存在就找到了最大的三元环。

输出即可,n^3/64水过。

【代码】

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath> #include <set>
#include <bitset>
#include <map>
#include <string>
#include <algorithm>
#include <vector>
#include <iostream>
#include <queue> using namespace std; #define maxn 3010
#define mlog 16
#define F(i,j,k) for (int i=j;i<=k;++i)
#define inf (0x3f3f3f3f) int Getint()
{
int x=0,f=1; char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0'&&ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
} struct edge{int l,r;double d;}e[maxn*maxn];
struct Point{int x,y;}a[maxn];
int n,cnt=0;
bool cmp(edge x,edge y){return x.d>y.d;}
bitset <maxn> b[maxn]; int main()
{
n=Getint();
F(i,1,n)
{
a[i].x=Getint();
a[i].y=Getint();
}
F(i,1,n-1)
F(j,i+1,n)
{
e[++cnt].l=i;
e[cnt].r=j;
e[cnt].d=sqrt((a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y));
}
sort(e+1,e+cnt+1,cmp);
F(i,1,cnt)
{
if ((b[e[i].l]&b[e[i].r]).count())
{
printf("%.20f\n",e[i].d/2);
return 0;
}
b[e[i].l][e[i].r]=1;
b[e[i].r][e[i].l]=1;
}
}

  

Codeforces 333E Summer Earnings ——Bitset的更多相关文章

  1. Codeforces 333E Summer Earnings - bitset

    题目传送门 传送门I 传送门II 传送门III 题目大意 给定平面上的$n$个点,以三个不同点为圆心画圆,使得圆两两没有公共部分(相切不算),问最大的半径. 显然答案是三点间任意两点之间的距离的最小值 ...

  2. Codeforces 333E Summer Earnings(bitset)

    题目链接 Summer Earnings 类似MST_Kruskal的做法,连边后sort. 然后对于每条边,依次处理下来,当发现存在三角形时即停止.(具体细节见代码) 答案即为发现三角形时当前所在边 ...

  3. CodeForces 333E. Summer Earnings

    time limit per test 9 seconds memory limit per test 256 megabytes input standard input output standa ...

  4. Codeforces 232E - Quick Tortoise bitset+分治

    题意: 思路: //By SiriusRen #include <cstdio> #include <bitset> #include <vector> using ...

  5. Codeforces Gym 100342J Problem J. Triatrip 求三元环的数量 bitset

    Problem J. Triatrip Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/at ...

  6. codeforces 707D-(DFS+bitset)

    题目链接:http://codeforces.com/contest/707/problem/D 根据询问建立一棵树然后DFS. #include<bits/stdc++.h> using ...

  7. Codeforces Gym 100342J Problem J. Triatrip bitset 求三元环的数量

    Problem J. TriatripTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/att ...

  8. Codeforces 917F Substrings in a String - 后缀自动机 - 分块 - bitset - KMP

    题目传送门 传送点I 传送点II 传送点III 题目大意 给定一个字母串,要求支持以下操作: 修改一个位置的字母 查询一段区间中,字符串$s$作为子串出现的次数 Solution 1 Bitset 每 ...

  9. Codeforces 788C The Great Mixing(背包问题建模+bitset优化或BFS)

    [题目链接] http://codeforces.com/problemset/problem/788/C [题目大意] 给出一些浓度的饮料,要求调出n/1000浓度的饮料,问最少需要多少升饮料 [题 ...

随机推荐

  1. strong 、weak、copy 、assign 、retain 、unsafe_unretained 与autoreleasing区别和作用

    strong关键字与retain关似,用了它,引用计数自动+1,用实例更能说明一切 @property (nonatomic, strong) NSString *stringA; @property ...

  2. 解决activeandroid no such table

    场景:activeandroid拷贝数据库 (1)复制sql数据库到项目的assets目录,例如/myapp/src/main/assets/prepop.db (2)确保manifest的AA_DB ...

  3. MVC 学习小总结

    一般情况下新增字段首选现在数据库更新,然后再从数据库更新模型 第二选择是从模板添加字段更新数据库(面临删除所有数据可能,慎用) 第三是没有T4模板的前提下再模型完成操作然后修改model类防止mode ...

  4. Gym 100342I Travel Agency (Tarjan)

    题意读懂了就好做了,就是求一下点双连通分量.维护一下一颗子树的结点数,对于一个结点当u是割点的时候, 统计一下u分割的连通分量v,每得到一个连通分量的结点数cnt(v)和之前连通分量结点数sum相乘一 ...

  5. UVA1001 Say Cheese (dijkstra)

    如果没有洞,那么任意两点的最短距离就是直线距离,洞里是瞬间的,所以看成一个点就行了(其实点也可以当作半径为0的洞来处理),洞到洞的最短距离都是圆心距离减去半径.剩下的就是求单源最短路径,是完全图,用不 ...

  6. jni 修bug

     1. ReferenceTable overflow (max=512)  内存泄露,程序运行一段时间就挂掉了. 在利用反射调用java中的函数需要释放掉查找到的类 void publishJava ...

  7. python简单爬虫爬取百度百科python词条网页

    目标分析:目标:百度百科python词条相关词条网页 - 标题和简介 入口页:https://baike.baidu.com/item/Python/407313 URL格式: - 词条页面URL:/ ...

  8. PyTorch在NLP任务中使用预训练词向量

    在使用pytorch或tensorflow等神经网络框架进行nlp任务的处理时,可以通过对应的Embedding层做词向量的处理,更多的时候,使用预训练好的词向量会带来更优的性能.下面分别介绍使用ge ...

  9. Python 输入输出 数据类型 变量

    python输入输出 数据类型 变量 输入输出 print()在Python3中是函数 >>>print('hello world') #print注意print前面不要有任何空格 ...

  10. Java截取视频文件缩略图

    /** * 截取视频第0帧的图片 */public static void videoImage(String filePath, String fileName,int widthdist, int ...