上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 25 下一页

2014年7月23日

删除物品

摘要: HYSBZ 3192:http://www.lydsy.com/JudgeOnline/problem.php?id=3192题意:中文题。题解:把两个堆头对头并起来。例如样例:5 4 1 2 7 3,然后两堆之间的设置mid,对于每一次删除最大的来说,例如,删除7,我们要知道上一次mid的位子,然... 阅读全文

posted @ 2014-07-23 18:17 天依蓝 阅读(127) 评论(0) 推荐(0) 编辑

2014年7月22日

Ultra-QuickSort

摘要: poj2299:http://poj.org/problem?id=2299题意:就是求逆序对。题解:直接用树状数组,但是这一题要你离散化,如果用之前的vector来离散化的话,会T的,自己用一个数组搞一下,然后二分查找,用lower_bound来搞一下,比vector要快。还有,答案要用long ... 阅读全文

posted @ 2014-07-22 21:26 天依蓝 阅读(132) 评论(0) 推荐(0) 编辑

Matrix(线段树版)

摘要: poj2155:http://poj.org/problem?id=2155题意;同上一遍随笔。题解:这里用二维线段树打了一发。第一次学习别人的代码。才学的。这种树套树的程序,确实很费脑子,一不小心就会晕了,而且这次是用省空间的方法写的。 1 #include 2 #include 3 #inclu... 阅读全文

posted @ 2014-07-22 20:17 天依蓝 阅读(148) 评论(0) 推荐(0) 编辑

Matrix

摘要: poj2155:http://poj.org/problem?id=2155题意:给你一个n*n的矩阵,初始的时候里面的元素都是0,然后又两种操作,一种是C x1 y1 x2 y2把(x1,y1)--(x2,y2)这个矩阵里面的元素取反。Q(x1,y1),查询元素(x1,y1)的值。题解:二维树状数... 阅读全文

posted @ 2014-07-22 17:32 天依蓝 阅读(155) 评论(0) 推荐(0) 编辑

Color the ball

摘要: hdu1556:http://acm.hdu.edu.cn/showproblem.php?pid=1556题意:中文题。题解:这一题当然可以直接用线段树来打,但是最近在学树状数组,所以用树状数组打了。树状数组有两种更新和求和的方式。1是向上更新,向下查询。2是向下更新,向上查询。第二种可以用来区间... 阅读全文

posted @ 2014-07-22 16:14 天依蓝 阅读(133) 评论(0) 推荐(0) 编辑

Coupons

摘要: uva10288:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1229题意:有一种盒子,盒子一面会随机放一种卡片,现在要集齐n种卡... 阅读全文

posted @ 2014-07-22 12:37 天依蓝 阅读(189) 评论(0) 推荐(0) 编辑

密码箱

摘要: HYSBZ 1406:http://www.lydsy.com/JudgeOnline/problem.php?id=1406题意:找出x*x%n==1,x 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespac... 阅读全文

posted @ 2014-07-22 10:48 天依蓝 阅读(136) 评论(0) 推荐(0) 编辑

Milking Grid

摘要: poj2185:http://poj.org/problem?id=2185题意:在一个字符矩阵中,找一个最小的字符子矩阵,使其能够覆盖整个矩阵。题解:在KMP中i-next[i]是这能够覆盖这个串的最小串长度。所以这一题可以用KMP搞。对于每一行求一个最小覆盖,然后取其最小公倍数,如果最大的那个覆... 阅读全文

posted @ 2014-07-22 08:44 天依蓝 阅读(159) 评论(0) 推荐(0) 编辑

2014年7月21日

Substrings

摘要: hdu1238:http://acm.hdu.edu.cn/showproblem.php?pid=1238题意:给你n个串,求一个子串,这个子串在所有串中都出现,或者在逆串中出现。求最大的这个子串长度。题解:分析一下,这个子串肯定会在最短的串中出现,所以,枚举最小串的所有子串,并且从最大的子串开始... 阅读全文

posted @ 2014-07-21 12:28 天依蓝 阅读(148) 评论(0) 推荐(0) 编辑

2014年7月20日

亲和串

摘要: hdu2203:http://acm.hdu.edu.cn/showproblem.php?pid=2203题意:给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我们就说s2 是s1的亲和串。题解:把s1拼接两遍,然后直接用KMP搞定。例如 s1=abcd,s2==bcda... 阅读全文

posted @ 2014-07-20 20:24 天依蓝 阅读(291) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 25 下一页

导航