hdu 5277 YJC counts stars】的更多相关文章

hdu 5277 YJC counts stars 题意: 给出一个平面图,n个点,m条边,直线边与直线边之间不相交,求最大团的数目. 限制: 1 <= n <= 1000 思路: 因为平面图,直线边与直线边之间不相交,所以最大团的大小最大为4,m<=3*n-6. 所以对于答案4,枚举两条边. 对于答案3,枚举一条边一个点. /*hdu 5277 题意: 给出一个平面图,n个点,m条边.直线边与直线边之间不相交,求最大团的数目. 限制: 1 <= n <= 1000 思路:…
YJC counts stars Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5277 Description YJC是个老火车小司机.一个晚上,他仰望天空,星辰璀璨,他突然觉得,天空就像一个平面,而每一个星辰,就是平面中的一个点.他把这些点编号为1到n.这些点满足任意三点不共线.他把一些点用线段连起来了,但是任意两条线段不会在端点以外相交.如果一个点的集合中任意两个…
YJC tricks time Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5276 Description YJC收到了一份神秘礼物.是一个长成这样的钟. YJC不是时间领主所以他并不能乱搞时间,但是这个钟实在是太难认了!所以他想来耍耍你. 现在YJC给你时针和分针间的夹角,让你告诉他现在是什么时候. 你将以以下格式给出可能的时间:HH:MM:SS分别表示小时,分钟…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5276   Sample Input 99000 0   Sample Output 00:01:30 11:58:30 00:00:00   题意: YJC收到了一份神秘礼物.是一个长成这样的钟. YJC不是时间领主所以他并不能乱搞时间,但是这个钟实在是太难认了!所以他想来耍耍你. 现在YJC给你时针和分针间的夹角,让你告诉他现在是什么时候. 你将以以下格式给出可能的时间:HH:MM:SS分别表示小…
Stars Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4052    Accepted Submission(s): 1592 Problem Description Astronomers often examine star maps where stars are represented by points on a plan…
Pen Counts Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 506    Accepted Submission(s): 319 Problem Description Chicken farmer Xiaoyan is getting three new chickens, Lucy, Charlie and CC. She…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5279 令 n 个点的树的 EGF 是 g(x) ,则 \( g(x) = \sum\limits_{i=0}^{\infty} \frac{i^{i-2}}{i!} x^i \) 令 n 个点的森林的 EGF 是 f(x) ,则 \( f(x) = \sum\limits_{i=0}^{\infty} \frac{g(x)^i}{i!} = e^{g(x)} \) 这道题里,每个团调用 f(x) 的对应…
题意 有 \(n\) 个岛屿,第 \(i\) 个岛屿上有一张 \(a_i\) 的完全图.其中第 \(i\) 张完全图的 \(a_i\) 号节点和 \(i+1\) 号岛屿的 \(1\) 号节点有边相连(包括 \(n\) 号岛屿和 \(1\) 号岛屿).求删去若干条边,使得图变成无环图的方案数. 思路 定义 \(f_n\) 为 \(n\) 个点的完全图,删边构成无环图的方案数,固定其中一点,从剩下 \(n-1\) 个点钟选出 \(i\) 个与之构成连通图,有 \[ f_n=\sum_{i=0}^{n…
题目传送门 题目大意:有$n$个小岛,每个小岛上有$a_{i}$个城市,同一个小岛上的城市互相连接形成一个完全图,第$i$个小岛的第$a_{i}$个城市和第$i+1$个小岛的第$1$个城市连接,特别地,第$n$个小岛的第$a_{n}$个城市和第$1$个小岛的第$1$个城市连接.现在要断掉图中的一些边,保证任意两个城市只有一条路径或者不连通,求合法的断边方案总数,$n,a_{i}<=1e5$ 完全不会(喷血 我们对每个小岛单独讨论 如果任意两个城市只有一条路径或者不连通,那么这张图只能是一个森林…
题目传送门 题目大意 给出\(n\)以及\(a_{1,2,...,n}\),表示有\(n\)个完全图,第\(i\)个完全图大小为\(a_i\),这些完全图之间第\(i\)个完全图的点\(a_i\)与\(i\bmod n+1\)的点\(1\)相连.问有多少种方法可以删掉某些边,使得整个图变成一个森林. 思路 话说因为是英文懒得读题,直接看题解里面的题目大意,结果一直理解不了,后来才发现他意思写错了...所以说一个正确的题目大意有多重要(雾 有一个人尽皆知的知识,就是\(n\)个点的树有\(n^{n…
HDU - 6184 C - Counting Stars 题目大意:有n个点,m条边,问有一共有多少个‘structure’也就是满足V=(A,B,C,D) and E=(AB,BC,CD,DA,AC)这样一个图形,类似于四边形中间连接了一条对角线. 如果我们把这个四边形拆分的话,其实就是两个共用一条边的三角形,而在图中就是三元环.求三元环有两种求法,个人感觉这个三元环的时间复杂度很玄学. 第一种一种就是枚举点x,然后枚举和点x相连的y,这时根据y的度,如果y的度小于等于sqrt(m),那么我…
CDQ学习资料 day1cdq分治相关 CDQ的IOI论文 1.优化斜率dp 左边对右边影响维护一个凸包解决 需要知识:①凸包②斜率dp 题目:√ HDU3842 Machine Works   HYSBZ 1492 货币兑换Cash 2.三维/多维偏序 cdq降维,剩下用数据结构维护. 需要知识:①LIS②偏序关系③二维线段树/树状数组 题目:陌上花开(此题目前找不到) Pinball Game3D 3.CDQ+FFT/NTT 需要知识:①FFT②NTT 题目:HDU 5730 Shell N…
Dancing Stars on Me Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5533 Description The sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, somet…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5533 Dancing Stars on Me Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 601    Accepted Submission(s): 320 Problem Description The sky was brush…
hdu 6184 Counting Stars(三元环计数) 题意: 给一张n个点m条边的无向图,问有多少个\(A-structure\) 其中\(A-structure\)满足\(V=(A,B,C,D)\) && \(E=(AB,BC,CD,DA,AC)\) 显然\(A-structure\)是由两个有公共边的三元环构成的 \(1 <=n <= 1e5\) \(1 <= m <= min(2e5,n*(n-1)/2)\) 思路: 三元环计数 做法1. ①统计每个点…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1541 思路:要求求出不同等级的星星的个数,开始怎么也想不到用树状数组,看完某些大神的博客之后才用树状数组写的,搞了好久才懂得数组的更新过程 #include<cstdio> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<ve…
Dancing Stars on Me Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 186    Accepted Submission(s): 124 Problem Description The sky was brushed clean by the wind and the stars were cold in a bl…
Stars Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 41521   Accepted: 18100 Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a st…
Problem Description Yifenfei is a romantic guy and he likes to count the stars in the sky. To make the problem easier,we considerate the sky is a two-dimension plane.Sometimes the star will be bright and sometimes the star will be dim.At first,there…
Problem Description The sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky if we connect them properly. You want to record the…
Problem Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given…
一開始想,总感觉是DP,但是最后什么都没想到.还暴力的交了一发. 然后開始写线段树,结果超时.感觉自己线段树的写法有问题.改天再写.先把树状数组的写法贴出来吧. ~~~~~~~~~~~~~~~~~~~~~~~~ 树状数组不懂的去看刘汝佳的大白书,那个图画得非常清楚. 题目大意:星星的坐标以y递增的顺序给出,这些点的左下方的点数代表这个点的级数,问0~N-1的级数有多少个?事实上y根本木实用. 题目链接:http://poj.org/problem?id=2352 http://acm.hdu.e…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6184 题意: n个点m条边的无向图,问有多少个A-structure 其中A-structure满足V=(A,B,C,D) && E=(AB,BC,CD,DA,AC) 解法: 可以看出A-structure是由两个有公共边的三元环构成的,然后就变成了这道题. http://www.cnblogs.com/spfa/p/7495438.html #include <stdio.h>…
HDU - 1541 思路:二维偏序,一维排序,一维树状数组查询即可. #include<bits/stdc++.h> using namespace std; #define maxn 33333 int ans[maxn],n,sum[maxn]; int lowbit(int x) { return x&(-x); } struct node { int x,y; bool operator < (const node &b)const { if(x==b.x)re…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5126 思路:支持离线,那么我们可以用两次CDQ分治使四维降为二维,降成二维后排个序用树状数组维护下就好了 实现代码: #include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; ; int ans[M],c[M]; struct node { int x,y,z; int kind,id; node(){} no…
题目http://acm.hdu.edu.cn/showproblem.php?pid=1541 n个星星的坐标,问在某个点左边(横坐标和纵坐标不大于该点)的点的个数有多少个,输出n行,每行有一个数字,代表左下角个点数为i( i 从0开始)的点的个数. 首先将横坐标排序,这样就值需要比较纵坐标,可以采用hash的方法记录纵坐标为 i 的个数,每枚举到一个点hash加一,然后树状数组求纵坐标 不大于该点的 个数.值得注意的是树状数组是由 1 开始的,而题目可以从0开始,会超时,加一就好. 具体看代…
 Problem Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the giv…
Time Limit: 1000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 930    Accepted Submission(s): 200 Problem Description Can you believe it? After Gardon had solved the problem, Angel accepted him! They were sitt…
Problem Description Little A is an astronomy lover, and he has found that the sky was so beautiful!So he is counting stars now!There are n stars in the sky, and little A has connected them by m non-directional edges.It is guranteed that no edges conn…
Problem Description Little A is an astronomy lover, and he has found that the sky was so beautiful! So he is counting stars now! There are n stars in the sky, and little A has connected them by m non-directional edges. It is guranteed that no edges c…