摘要: 题解:同BZOJ 3211 花神游历各国,需要注意的是需要开long long,还有左右节点需要注意一下。#include #include #include #include using namespace std;typedef long long LL;LL a[100005],c[10000... 阅读全文
posted @ 2014-07-20 16:17 forever97 阅读(546) 评论(0) 推荐(0) 编辑
摘要: 题解:首先,单点修改求区间和可以用树状数组实现,因为开平方很耗时间,所以在这个方面可以优化,我们知道,开平方开几次之后数字就会等于1 ,所以,用数组记录下一个应该开的数,每次直接跳到下一个不是1的数字进行开平方,至于这个数组,可以用并查集维护。#include #include #include u... 阅读全文
posted @ 2014-07-20 16:14 forever97 阅读(1034) 评论(1) 推荐(2) 编辑
摘要: 题解:首先,这道题可以用位运算来表示每一行的状态,同八皇后的搜索方法,然后对于限制条件不相互攻击,则只需将新加入的一行左右移动与上一行相&,若是0则互不攻击,方案可行。对于每种方案,则用递推来统计,将前一排所有可以的情况全部加上即可。bit数组记录每个数字二进制位中1的个数,方便计算。if(chec... 阅读全文
posted @ 2014-07-20 14:53 forever97 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 题解:http://vfleaking.blog.163.com/blog/static/17480763420119685112649/#include #include using namespace std;struct data{int a[101],len;};data mul(data ... 阅读全文
posted @ 2014-07-20 09:22 forever97 阅读(395) 评论(0) 推荐(0) 编辑