自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 3-idiots HDU - 4609 FFT模板

给N个木棍问任选三个可组合出三角形的概率 以前写的,整理整理存个档 //#pragma comment(linker, "/STACK:1024000000,1024000000") //#include #include #include #include #include #include #include #include #include #include #include us

2017-11-30 15:42:22 214

原创 2017南宁现场赛E 存档

现场时间不够,没加记忆化T了,滚cu 当时还写错了mx1,mx2的关系。。。 出场喜闻乐见有人加记忆化传参递归过。。 这份代码未必是正解,等到放上hdu交上去试试吧。。 #include //#pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #inc

2017-11-28 21:54:20 273

原创 BZOJ1056 [HAOI2008]排名系统 treap实现map

需要的功能: ①更新一个字符串对应的最新分数 ②获得一个字符串对应的最新分数 ③获得平衡树中第几名 hint是哈希,感觉没什么头绪。。 题解存下了字符串和一个哈希内存池,用链式前向星处理hash冲突,用时间戳作为第二比较关键字,在分数相同时检索时间戳 具体来说就是在查询一个字符串时,先在哈希内存池顺着前向星用字符串匹配找到时间戳, 再用分数和时间戳的关键字从treap中找到对应信息(

2017-11-28 21:13:17 213

原创 线段树区间加板子

#include #include #include #include #include #include using namespace std; #define maxn 101000 #define maxq 101000 int Sum[maxn << 2]; int Add[maxn << 2]; int n, t, q; int a, b, c; int ans; void push

2017-11-24 00:22:35 262

原创 BZOJ1015: [JSOI2008]星球大战starwar

要求支持图上的动态删点&&维护联通块个数 似乎这个要求4e5个点不太可做。。 正解是离线下来之后倒序用并查集加点 。。。长见识了 #include //#pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #include #include #inc

2017-11-22 23:29:57 239

原创 894D - Ralph And His Tour in Binary Country 完全二叉树点对计数

打完模拟被xz忽悠去码,粗略听了一波题解之后开始搞 总体感觉自己码力确实有进步了。。起码遇到啥问题了会找地方改,改啥肯定能出想要的效果。。 好像别人的代码都很短啊?我感觉自己这版写的逻辑挺清楚的。。就是长了点。。 一点一点实现自己脑内搭建的逻辑还是挺愉快的。。 //#include //#pragma comment(linker, "/STACK:1024000000,10240

2017-11-22 03:28:28 224

原创 Codeforces Round #367 (Div. 2) Vasiliy's Multiset 异或字典树带删除模板

多重集版的异或字典树,拿之前的板子改改就交了 莫名wa7,回忆一波代码意义之后感觉没问题啊 读读题发现这个多重集里居然永远有0 。。。 赛中debug出来还是挺开心的

2017-11-22 03:19:52 173

原创 Codeforces Round #446 (Div. 2) D

讨论版提供的一个思路,感觉挺好的 Yes, and it's easy to prove. Let's consider for convenience the permuted arrays a and b: a1a2a(N-1)aN ^ ^ ^ v a2a3aN >a1 If we take any subset that doesn't co

2017-11-18 03:33:11 172

原创 BZOJ1067 [SCOI2007]降雨量 模拟/线段树/map经验书

从知道x,y能是没出现过的我就知道GG了 学到了max_element以及map的一些坑 map的lower_bound熟练度++ #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll

2017-11-15 23:57:03 247

原创 BZOJ1087 [SCOI2005]互不侵犯King 状压DP

参考自き 9*9的棋盘问能放多少互不攻击的国王。。 这种预处理状态间能否转移的做法还是第一次见(naive 不过用位运算判转移可能性在当状态大存不下没法预处理的时候也不算慢。。? 左右移位判重合挺巧妙的。。。 #include #include #include #include #include #include #include #include #include #includ

2017-11-14 20:46:32 160

原创 unique离散化用法

用法类似lower_bound,sort,不过下标从1开始的话和lower_bound减去的东西不一样 用来离散化很好用 pos就是在原数组a中的rank了,根据cnt建线段树啥的。。。 sort(a2+1, a2+1+n); cnt = unique(a2+1, a2+1+n) - (a2+1); FOR(n) { int pos = lower_bound(a2+

2017-11-13 15:41:21 569

原创 BZOJ1295 [SCOI2009]最长距离 智商

大体就是给一个01矩阵,1不可通行,可以破坏k[0,30]个1方格,问最长欧式距离 脑洞1小时没啥想法。。给正解跪。。居然是跑破坏方块的最短路,然后枚举点对更新答案,只要点对的最短路距离 naive! #include #include #include #include #include #include #include #include #include #include #inc

2017-11-11 21:58:33 160

原创 BZOJ4017 小Q的无敌异或 好题

给一个序列 询问这个序列 1:所有子区间的异或值的和 2:所有子区间的和的异或值 第一个操作,拆二进制位,枚举右端点r,记录这个位前r个数字0/1的个数,右端点转移O(1) 第二个操作比较复杂,对于每个右端点要询问sum[r]-sum[l-1]mod(2^(k+1))>=2^k的左端点个数(的奇偶性) 题解用了树状数组维护,参考skywalkert,题解里对于模不等式的解释很巧妙,复习

2017-11-10 00:47:03 720

原创 [HNOI2005]狡猾的商人 带权并查集

给定m个区间和,问是否有矛盾 复习一下,带权并查集保存着这个元素与祖先的关系 在合并的过程中就像向量合并一样,可以画出x->fa[x],y->fa[y],x->y这样的图方便理解 这篇文章解释得很清楚NOIAu //#include #include #include #include #include #include #include #include #include #incl

2017-11-08 20:58:40 188

原创 [HAOI2006]受欢迎的牛 scc分解(下标从1)

如果有x满足答案,x所在的scc也满足答案 合法scc个数不会超过1,因为这样的话2个scc是传递的,应该可以合并才对 这个板子做法是按照拓扑序排列缩点后的图的,所以可能成为答案的scc一定是最后那个 //#include #include #include #include #include #include #include #include #include #include #inc

2017-11-08 17:04:47 276

原创 BZOJ3039 最大01子矩阵 单调栈

//#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define ull unsigned long long #define pb push_back #defi

2017-11-06 20:19:00 669

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除