hdu Counting Sheepsuanga】的更多相关文章

算法:深搜 题意:让你判断一共有几个羊圈: 思路:像四个方向搜索: Problem Description A while ago I had trouble sleeping. I used to lie awake, staring at the ceiling, for hours and hours. Then one day my grandmother suggested I tried counting sheep after I'd gone to bed. As always…
Boring counting Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 98304/98304 K (Java/Others) Total Submission(s): 2811    Accepted Submission(s): 827 Problem Description In this problem we consider a rooted tree with N vertices. The vertices a…
Counting Squares Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1885    Accepted Submission(s): 946 Problem Description Your input is a series of rectangles, one per line. Each rectangle is sp…
Boring counting Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=3518 Mean: 给你一个字符串,求:至少出现了两次(无重叠)的子串的种类数. analyse: 后缀数组中height数组的运用,一般这个数组用得很少. 总体思路:分组统计的思想:将相同前缀的后缀分在一个组,然后对于1到len/2的每一个固定长度进行统计ans. 首先我们先求一遍后缀数组,并把height数组求出来.height数组代表的含…
传送门:hdu 5862 Counting Intersections 题意:对于平行于坐标轴的n条线段,求两两相交的线段对有多少个,包括十,T型 官方题解:由于数据限制,只有竖向与横向的线段才会产生交点,所以先对横向线段按x端点排序,每次加入一个线段,将其对应的y坐标位置+1,当出现一个竖向线段时,查询它的两个y端点之间的和即为交点个数. 注意点:对x坐标排序是对所有线段端点排序:因为可能出现 “  1-1  “ 这样的情况,所以对于横着的线段,需要进行首尾x坐标处理:我的方法是对于x坐标,先…
Counting Intersections 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5862 Description Given some segments which are paralleled to the coordinate axis. You need to count the number of their intersection. The input data guarantee that no two se…
Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 539    Accepted Submission(s): 204 Problem Description A clique is a complete graph, in which there is an edge between every pair…
HDU 5862 Counting Intersections(离散化+树状数组) 题目链接http://acm.split.hdu.edu.cn/showproblem.php?pid=5862 Description Given some segments which are paralleled to the coordinate axis. You need to count the number of their intersection. The input data guarant…
题目:Boring counting 链接:http://acm.hdu.edu.cn/showproblem.php?pid=3518 题意:给一个字符串,问有多少子串出现过两次以上,重叠不能算两次,比如ababa,aba只出现一次. 思路: 网上搜的题解估计大部分都是后缀数组,但字典树+优化是可以解决该问题的. 字典树解决这题难点就是内存,先不考虑内存,那么可以遍历起始点,然后添加入字典树,比如现在abab要添加进字典树,如果原本已经存在abab,并且两个不重叠,那么ans++,同时将aba…
题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5862 Counting Intersections Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描述 Given some segments which are paralleled to the coordinate axis. You need to coun…