摘要: 题目链接虽然是看的别的人思路,但是做出来还是挺高兴的。首先求环上最大字段和,而且不能是含有全部元素。本来我的想法是n个元素变为2*n个元素那样做的,这样并不好弄。实际可以求出最小值,总和-最小,就可以求出,断开的情况了。然后线段树要单点更新,这种标记,以前遇到过,不过一直没有写过,注意总和好更新,整个这一段的结果也很好更新,最难想的就是左边 和右边标记的结果,具体看pushup代码。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 阅读全文
posted @ 2013-06-19 16:19 Naix_x 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 做了俩,rating涨了80。第二个题是关于身份证的模拟题,写的时间比较长,但是我认真检查了。。。第三个题是最短路,今天写了写,写的很繁琐,写的很多错。 1 #include <cstring> 2 #include <cstdio> 3 #include <string> 4 #include <iostream> 5 #include <algorithm> 6 #include <vector> 7 #include <queue> 8 using namespace std; 9 #define INF 阅读全文
posted @ 2013-06-19 10:43 Naix_x 阅读(284) 评论(0) 推荐(0) 编辑