以前用树状数组做过一次,现在用线段树再刷一次。。。
首先必须先离散化。。。
然后建立2颗线段树,第一颗表示往左走,每个节点的值的分布。
第二颗表示往右走,每个节点的值的分布。
然后根据左右走的关系,判断出x,y的值。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include
#include
#inclu...
分类:
其他好文 时间:
2014-06-03 01:25:54
阅读次数:
315
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=2102
题目:
A计划
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8731 Accepted Submis...
分类:
其他好文 时间:
2014-06-02 23:29:29
阅读次数:
207
从一开始学离散化就对它没有半毛钱好感,感觉出这种题纯属恶心人。
可以将Top x全部取出来然后离散化,缩点。剩下的就是伸展了,不再赘述。
也有人拿线段树过,一直没有想明白. . .
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment...
分类:
其他好文 时间:
2014-06-02 23:24:50
阅读次数:
338
TOJ 614173971
HDU 宇智波佐助
POJ shiai
ZOJ henyumen
UVa henyumen
Light OJ HENYUMEN...
分类:
其他好文 时间:
2014-06-01 13:59:09
阅读次数:
210
题目:
链接:点击打开链接
题意:
思路:
dp[i][j]表示前i个箱子装j钱的材料能够得到的最大价值。
代码:
#include
#include
#include
using namespace std;
#define MAXN 100010
int dp[55][MAXN];
int main()
{
//freopen("inpu...
分类:
其他好文 时间:
2014-06-01 13:57:14
阅读次数:
270
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2089题意:给出一个区间[l,r],求满足一个数的数位上没有连着62这个数字串的条件的个数。解法:数位DP的入门题。
1 #include 2 #include 3 #include 4 #include...
分类:
其他好文 时间:
2014-06-01 12:27:14
阅读次数:
229
湫湫系列故事——植树节Time Limit: 1000/500 MS (Java/Others)
Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1025 Accepted
Submission(s): 604P...
分类:
其他好文 时间:
2014-06-01 12:09:46
阅读次数:
143
MinesTime Limit: 10000/5000 MS (Java/Others)Memory
Limit: 65536/65536 K (Java/Others)Total Submission(s): 1110Accepted
Submission(s): 280Problem Descr...
分类:
其他好文 时间:
2014-06-01 11:38:48
阅读次数:
312
http://acm.hdu.edu.cn/showproblem.php?pid=1429
第一次接触搜索+状态压缩 看了大神的题解 勉强把题目弄懂了。
用二进制来表示手头的钥匙有哪些,100表示有第三把钥匙,111表示有第三、二、一把,搜索下一点时,如果该点为钥匙点,则可采用|运算来
模拟拾取,显然0001 | 1000 = 1001,同理,当为相应的门时采用&运算来模拟开启,例...
分类:
其他好文 时间:
2014-06-01 10:35:21
阅读次数:
256
Description
Some strange code is sent to Da Shan High School. It's said to be the prophet's note. The note is extremely hard to understand. However, Professor Meng is so smart that he successfully ...
分类:
其他好文 时间:
2014-06-01 09:18:38
阅读次数:
246