- 博客(21)
- 资源 (1)
- 收藏
- 关注
原创 【HDU】5333 Undirected Graph【LCT+BIT】
传送门:【HDU】5333 Undirected Graphmy code:my~~code:#pragma comment(linker, "/STACK:1024000000")#include <stdio.h>#include <string.h>#include <map>#include <algorithm>using namespace std ;typedef long
2015-07-31 13:07:53 1330
原创 【ZOJ】3881 From the ABC conjecture【暴力容斥】
传送门:【ZOJ】3881 From the ABC conjecture复杂度大概O(N0.67)O(N^{0.67}),我也不会算www,首先转换一下(我们是根据积性函数打表找规律得到的,也可以推出来)使得: g(N)=∏pi ϵ N(pia+1)g(N)=\prod_{pi~\epsilon ~N} (pi^a+1) 暴力展开发现贡献为: h(N)=∑x=1N∑y=1N(x⋅y≤N an
2015-07-29 17:12:38 1121
原创 【HDU】5321 Beautiful Set【枚举k求贡献,欧拉函数应用】
传送门: 【HDU】5321 Beautiful Setmy code:my~~code:#include <stdio.h>#include <string.h>#include <vector>#include <algorithm>using namespace std ;typedef long long LL ;#define clr( a , x ) memset ( a ,
2015-07-29 12:09:12 1168
原创 【HDU】5320 Fan Li【线段树】
传送门:【HDU】5320 Fan Limy code:my~~code:#include <stdio.h>#include <string.h>#include <vector>#include <algorithm>using namespace std ;typedef long long LL ;#define clr( a , x ) memset ( a , x , size
2015-07-28 21:56:33 1440 2
原创 【ZOJ】3889 Making Sequence【构造】
传送门:【ZOJ】3889 Making Sequence根据题意构造即可。ZOJ月赛我们抢的第二个FBwwwmy code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef unsigned long long ULL ;const int MAXN = 205 ;ULL n , a , b , s , t ;ULL
2015-07-28 09:25:26 1132
原创 【ZOJ】3886 Nico Number【线段树】
传送门:【ZOJ】3886 Nico NumberYY方法出只有2的幂次和素数是等差的,打表验证发现只有6是反例,注意到0项也是等差,所以0和1也算。每个数最多logn次取模,所以区间更新暴力到叶子就行。ZOJ月赛的时候抢了这题的FB ^_^my code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef long lon
2015-07-28 09:01:37 857
原创 【HDU】5314 Happy King【动态树(点分治)】
传送门:【HDU】5314 Happy King算法分析: 点分治,子树去重类可做。对于一个重心,取出所有路径按照最大值排序,扫下最小值,插入到线段树里维护个数,双指针扫扫解决。然后对所有重心的儿子对应的子树再做一次去重。这个方法我是今早在床上想了下想到的。 我是动态树,动态树比较裸,对点权排序,然后双指针扫扫,接下来就是链接两棵子树或者拆分两棵子树时的子树的siz。子树siz可以用两个变量维护
2015-07-27 16:29:37 1847
原创 【HDU】5313 Bipartite Graph【二分图+背包】
传送门:【HDU】5313 Bipartite Graph复杂度:O(NN√logN32)O(\frac{N\sqrt{N}\log{N}}{32}) 方法:多重背包bitset优化my code:my~~code:#include <stdio.h>#include <string.h>#include <bitset>#include <algorithm>using namespa
2015-07-27 16:13:31 824
原创 【HDU】5309 JRY is Fighting【DP】
传送门:【HDU】5309 JRY is Fightingmy code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef long long LL ;const int MAXN = 500005 ;int a[MAXN] ;int R[MAXN] ;int d[MAXN] ;int nxt[MAXN] ;int
2015-07-27 16:05:25 1195
原创 【HDU】5307 He is Flying【分别统计+NTT】
传送门:【HDU】5307 He is FlyingPS:神奇的姿势可以用double或long double过(FFT),我是过不了my code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef long long LL ;#define clr(a,x) memset ( a , x , sizeof a )cons
2015-07-27 16:03:42 1586
原创 【HDU】5304 Eastest Magical Day Seep Group's Summer【环dp+生成树计数】
传送门:【HDU】5304 Eastest Magical Day Seep Group’s Summermy code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef long long LL ;#define clr( a , x ) memset ( a , x , sizeof a )const int MAXN
2015-07-27 15:58:56 866
原创 【HDU】 5302 Connect the Graph【构造】
传送门:【HDU】 5302 Connect the Graphmy code:my~~code:#include <bits/stdc++.h>using namespace std ;typedef long long LL ;typedef unsigned long long ULL ;const int MAXN = 10005 ;int y[MAXN][2] ;void solve
2015-07-27 15:57:53 802
原创 【HDU】5298 Solid Geometry Homework【暴力+二分图】
传送门:【HDU】5298 Solid Geometry Homeworkmy code:my~~code:#include <stdio.h>typedef long long LL ;struct Node { LL x , y , z , d ;} a[100] , b[10] ;int n , m , p , q ;LL f ( LL x ) { return ( LL
2015-07-27 15:54:39 890
原创 【HDU】5296 Annoying problem【树链剖分+分类讨论】
传送门:【HDU】5296 Annoying problem这题我是分类讨论做的,没想到多校题解的方法my code:my~~code:#include <stdio.h>#include <string.h>#include <algorithm>using namespace std ;typedef long long LL ;#define clr(a,x) memset ( a ,
2015-07-27 15:52:24 935
原创 【HDU】5293 Tree chain problem【DP+LCA】
传送门:【HDU】5293 Tree chain problemmy code:my~~code:/************************************************************************* > File Name: F.cpp > Author: poursoul > Created Time: 2015年07月22
2015-07-27 15:48:50 645
原创 【HDU】5291 Candy Distribution 【DP+打标记】
传送门:【HDU】5291 Candy Distributionmy code:my~~code:/************************************************************************* > File Name: D.cpp > Author: poursoul > Created Time: 2015年07月22
2015-07-27 15:44:58 1188
原创 【HDU】5290 Bombing plan 【树形DP】
传送门:【HDU】5290 Bombing planmy code:my~~code:#include <stdio.h>#include <string.h>#include <vector>#pragma comment(linker, "/STACK:16777216")#include <algorithm>using namespace std ;typedef long lo
2015-07-27 15:42:26 1362
原创 【快速筛可能是大费马素数的数】
为什么写这样一篇博客呢……,原因是今天的多校有道题用到了NTT,然后用双模数然后中国剩余定理我被卡到死,直到我中间运算数组换成了int才卡过。之后我发现,竟然有一个O(1)的大数快速乘法(进行运算的数都在long long内)。根据这个,我发现NTT完全可以通过寻找一个超级大的费马素数来实现(比运算后的系数还大~),代替双模数的中国剩余定理的NTT写法,因为这个常数太大了……通过我无聊到极点的耐心,
2015-07-24 00:37:43 1254 2
原创 【HDU】5279 YJC plays Minecraft【cdq分治+NTT】
传送门:【HDU】5279 YJC plays Minecraft忘记修改测试时的分治大小交了一发,不然就1A了……整个题目的关键在对N个点的森林个数计数,这个我是昨晚躺床上突然想到的www,不过队友早就过了……膜拜之。dp一直是我的弱点啊= =令fnf_n为n个点的生成树个数,幸运的是fn=nn−2f_n=n^{n-2}。则对于n个点的森林个数,有公式: dpn=∑i=1ndpn−iCi−1n−
2015-07-09 11:48:18 1362
原创 【codeforces】338E. Optimize! 【线段树】
传送门:【codeforces】338E. Optimize! 题目分析: 这题有两种解法,一个O(nn−−√)O(n\sqrt n)的,一个O(nlogn)O(nlogn)。 首先我们要转换下题意,题目描述的函数,我们可以这么考虑,a数组区间[L,L+len-1]中最大的元素和b数组中最小的元素,a中第二大的元素和b中第二小的元素……每一对的和都大于等于h。我们让b[i] = h - b[i]
2015-07-03 01:17:06 2989 1
原创 【codeforces】Codeforces Round #311 (Div. 2)only 【题解】
传送门:【codeforces】Codeforces Round #311 (Div. 2)A. Ilya and DiplomasB. Pasha and TeaC. Arthur and TableD. Vitaly and CycleE. Ann and Half-Palindrome题目分析: 首先,先说明下,我是十分十分十分暴力的做的,在不考虑空间复杂度的前提下……一开始我们预处理出[L
2015-07-01 01:55:53 1018
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人