摘要: trie+贪心 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int a[35],ch[N*35][2],sum[N*35],rt=1,sz=1,temp; int query(){ int k=rt; for(in 阅读全文
posted @ 2018-12-24 13:41 lqsno1 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 字符串hash,注意hash是关键字! #include<bits/stdc++.h> using namespace std; typedef unsigned long long ull; const int N=1000005; const ull k=10007; char a[N]; ul 阅读全文
posted @ 2018-12-24 13:30 lqsno1 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 分块第一题。。。 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=50005; int belong[N],block,n,q,l[N],r[N],num; ll a[N],s[N]; vo 阅读全文
posted @ 2018-12-23 00:24 lqsno1 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 裸的hash。 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int MOD=9999991,N=100005; struct edge{ int sum[7],next; }e 阅读全文
posted @ 2018-12-22 22:22 lqsno1 阅读(76) 评论(0) 推荐(0) 编辑
摘要: https://zhuanlan.zhihu.com/p/25017840 阅读全文
posted @ 2018-12-21 15:07 lqsno1 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 水。。。 #include<bits/stdc++.h> using namespace std; const int N=300005,inf=2147483647; int q[N],a[N],s[N]; int main(){ int n,m; scanf("%d%d",&n,&m); for 阅读全文
posted @ 2018-12-21 14:43 lqsno1 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 那个写平衡树是不可能写平衡树,这辈子都不可能写平衡树。只有链表才能维持的了生命。 #include<bits/stdc++.h> using namespace std; const int N=1e5+5,inf=2147483647; typedef pair<int,int> P; P a[N 阅读全文
posted @ 2018-12-21 14:33 lqsno1 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<queue> #include<algorithm> using namespace std; int n;int m;int q;int u;int v;int t; queue <int> q1;queue <int> q2;queue <i 阅读全文
posted @ 2018-12-20 22:04 lqsno1 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 众所周知答案为C(N,2*N)/(N+1)。 由于本juruo太弱,不会高精除法,只会质因数分解。复杂度多了个sqrt(N)? #include<bits/stdc++.h> using namespace std; typedef long long ll; ll a[1000100]; ll t 阅读全文
posted @ 2018-12-20 20:57 lqsno1 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 被题目坑爹好狠 是1到j(1<=j<=k)的最大和。。。还以为是k之前的最大字段和。。。 操作不用我说了把,两个对顶堆分别维护,单次操作复杂度O(1) #include<iostream> #include<algorithm> using namespace std; const int N=1e 阅读全文
posted @ 2018-12-20 20:28 lqsno1 阅读(60) 评论(0) 推荐(0) 编辑