摘要: 链表写法:新增加一个头结点来使插入操作统一。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 100001; 7 char text[N]; 8 char str[N]; 9 int next... 阅读全文
posted @ 2015-08-28 20:23 hxy_has_been_used 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 非常经典的差分约束系统的建模。求最小值需要转化为求最长路。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int INF = 99999999; 8 const int N = 50... 阅读全文
posted @ 2015-08-28 16:07 hxy_has_been_used 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 差分约束第一题,想明白以后就可以建图了。由于此题数据特殊,队列优化的spfa会超时,可以改成用栈来优化。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int INF = 99999... 阅读全文
posted @ 2015-08-28 13:59 hxy_has_been_used 阅读(121) 评论(0) 推荐(0) 编辑
摘要: “反转类问题”需要注意的是pushdown懒标记的时候要用异或(或者++%2)而不是赋值,因为它是和奇偶性有关系的。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 100001;... 阅读全文
posted @ 2015-08-28 09:57 hxy_has_been_used 阅读(109) 评论(0) 推荐(0) 编辑