上一页 1 2 3 4 5 6 ··· 11 下一页
摘要: 首先,块的大小确定的话,可以发现方案最多只有1种 然后就可以O(nsqrt(n))搞,不过会TLE 接着我们又发现,一个节点可以作一个块的根,当且仅当该节点的size能被块的大小整除 然后就可以O(nlogn)搞了 阅读全文
posted @ 2016-08-11 15:16 Yangjiyuan 阅读(118) 评论(0) 推荐(0) 编辑
摘要: x*2^m==l (mod n+1)x=(n/2+1)^m*l mod n+1 #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<cmath> #i 阅读全文
posted @ 2016-08-11 15:14 Yangjiyuan 阅读(384) 评论(0) 推荐(0) 编辑
摘要: 我们需要枚举根,然后从其子树内选尽量多的点,薪水不超过M,可是暴力复杂度不对。于是考虑自下而上合并树(开始每棵树内只有一个节点,就是自己) 每个树是一个堆,我们维护树的节点个数和薪水总和,合并时,不断弹出堆顶薪水最大的直到薪水总和不超过M,然后用领导力*节点个数更新答案。发现这个模型就是裸的左偏树。 阅读全文
posted @ 2016-08-11 15:12 Yangjiyuan 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 交了一发pb_ds 阅读全文
posted @ 2016-08-11 15:09 Yangjiyuan 阅读(137) 评论(0) 推荐(0) 编辑
摘要: sum= A*h+B*s排序 然后枚举height和speed的最小值 然后用两个指针:先枚举speed最小值,然后一边枚举v的最小值一边查询符合条件的人数。 阅读全文
posted @ 2016-08-11 15:08 Yangjiyuan 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #define maxn 100001 using namespace std; char s[maxn]; bool w[maxn]; int S[maxn],n,top,tt,T; bool pd(int l,int r) { for (int i=l;i<=r;i... 阅读全文
posted @ 2016-07-23 19:53 Yangjiyuan 阅读(245) 评论(0) 推荐(0) 编辑
摘要: #include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<cmath> #include<queue> using namespace std; typed 阅读全文
posted @ 2016-07-23 19:52 Yangjiyuan 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 先按斜率排序,再将最小的两条线入栈,然后依次处理每条线,如果其与栈顶元素的交点在上一个点的左边,则将栈顶元素出栈 ; 阅读全文
posted @ 2016-07-23 19:51 Yangjiyuan 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; #define MAXN 100000000 #define prime1 9983543 #define prime2 9804799 #define MOD 99999971 #define N 1010 int m,n,A,B,q; ... 阅读全文
posted @ 2016-07-23 19:49 Yangjiyuan 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 若Y小于等于sqrt(300000),暴力,对所有的插入的数都更新mn[i]。 若Y大于sqrt(300000),枚举kY,用并查集维护>=i的第一个数,这样只支持删除操作是O(1),然后倒着枚举一边,删除一个数x那么就fa[x]=fa[x+1] 阅读全文
posted @ 2016-07-23 19:48 Yangjiyuan 阅读(178) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 11 下一页