摘要: lazy-tag线段树。 #include #include #include using namespace std; const int maxn = 800000 + 10; struct Segtree { #define lc(x) ((x)r[x]) return; if(Lr[x]) return; if(Lr[x]) return;... 阅读全文
posted @ 2016-05-15 20:07 invoid 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 斜率优化dp。 #include #include #include using namespace std; const int maxn = 50000 + 10; struct Field { long long x,y; } t[maxn]; long long f[maxn],x[maxn],y[maxn]; int q[maxn],l,r; int ... 阅读全文
posted @ 2016-05-15 17:41 invoid 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 数位dp。 #include #include #include using namespace std; long long pow[15],f[15][10][10],resa[10],resb[10]; long long a,b; void add(long long a[],long long b[]) { for(int i=0;in) len--; for... 阅读全文
posted @ 2016-05-15 15:43 invoid 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 匈牙利匹配。 在邻接表中每条边以终点升序排序。从x最后一个点往前进行增广,这样每个点首先都能匹配到字典序最小的位置,如果前面的点找不到匹配点时,后面的点就匹配到稍大一点的y匹配点上。 建图说明:每个点有且只会有俩个点符合距离的要求,可以想想为什么。 y点要+n与x点区分开来。 #include #include #include #include using namespace st... 阅读全文
posted @ 2016-05-15 09:47 invoid 阅读(119) 评论(0) 推荐(0) 编辑